feat(mailgun): Add EU region support and UI configuration options #293
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release JSON Schema | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/release-workflow-schema.yml" | |
- "pyproject.toml" | |
- "keep/providers/**" | |
- "keep-ui/entities/workflows/model/yaml.schema.ts" | |
pull_request: | |
paths: | |
- ".github/workflows/release-workflow-schema.yml" | |
- "pyproject.toml" | |
- "keep/providers/**" | |
- "keep-ui/entities/workflows/model/yaml.schema.ts" | |
workflow_dispatch: | |
env: | |
PYTHON_VERSION: 3.11 | |
STORAGE_MANAGER_DIRECTORY: /tmp/storage-manager | |
SCHEMA_REPO_NAME: keephq/keep-workflow-schema | |
jobs: | |
generate-schema: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
outputs: | |
version: ${{ steps.get_version.outputs.version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Extract version from pyproject.toml | |
id: get_version | |
run: | | |
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v4.2.0 | |
with: | |
path: .venv | |
key: pydeps-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies using poetry | |
run: poetry install --no-interaction --no-root --with dev | |
- name: Save providers list | |
run: | | |
PYTHONPATH="${{ github.workspace }}" poetry run python ./scripts/save_providers_list.py | |
- name: Set up Node.js 20 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: keep-ui/package-lock.json | |
- name: Install Node dependencies | |
working-directory: keep-ui | |
run: npm ci | |
- name: Generate JSON Schema | |
working-directory: keep-ui | |
run: npm run build:workflow-yaml-json-schema | |
- name: Upload schema artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: workflow-schema | |
path: workflow-yaml-json-schema.json | |
release-schema: | |
runs-on: ubuntu-latest | |
needs: generate-schema | |
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }} | |
steps: | |
- name: Download schema artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: workflow-schema | |
path: . | |
- name: Checkout schema repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.SCHEMA_REPO_NAME }} | |
token: ${{ secrets.SCHEMA_REPO_PAT }} | |
path: schema-repo | |
- name: Set target branch variable | |
id: set_branch | |
run: | | |
if [ "${{ github.event_name }}" = "pull_request" ]; then | |
echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT | |
else | |
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Create or switch to target branch in schema repo | |
working-directory: schema-repo | |
run: | | |
git fetch origin | |
if git show-ref --verify --quiet refs/heads/${{ steps.set_branch.outputs.branch }}; then | |
git checkout ${{ steps.set_branch.outputs.branch }} | |
else | |
git checkout -b ${{ steps.set_branch.outputs.branch }} | |
fi | |
- name: Copy schema to target repository | |
run: | | |
cp workflow-yaml-json-schema.json schema-repo/schema.json | |
# Update schema with version info | |
jq --arg version "${{ needs.generate-schema.outputs.version }}" \ | |
--arg id "https://raw.githubusercontent.com/${{ env.SCHEMA_REPO_NAME }}/v${{ needs.generate-schema.outputs.version }}/schema.json" \ | |
'. + {version: $version, "$id": $id}' \ | |
schema-repo/schema.json > schema-repo/schema.tmp.json | |
mv schema-repo/schema.tmp.json schema-repo/schema.json | |
- name: Check if schema changed | |
id: check_changes | |
working-directory: schema-repo | |
run: | | |
git add schema.json | |
if git diff --cached --quiet schema.json; then | |
echo "changed=false" >> $GITHUB_OUTPUT | |
else | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit and push schema | |
if: steps.check_changes.outputs.changed == 'true' | |
working-directory: schema-repo | |
run: | | |
git config user.name "Keep Schema Bot" | |
git config user.email "no-reply@keephq.dev" | |
git commit -m "Release schema v${{ needs.generate-schema.outputs.version }}" | |
git push origin ${{ steps.set_branch.outputs.branch }} | |
if [ "${{ steps.set_branch.outputs.branch }}" = "main" ]; then | |
git tag "v${{ needs.generate-schema.outputs.version }}" | |
git push origin "v${{ needs.generate-schema.outputs.version }}" | |
fi | |
- name: Create GitHub Release | |
if: steps.check_changes.outputs.changed == 'true' && steps.set_branch.outputs.branch == 'main' | |
uses: softprops/action-gh-release@v1 | |
with: | |
repository: ${{ env.SCHEMA_REPO_NAME }} | |
tag_name: v${{ needs.generate-schema.outputs.version }} | |
name: Release v${{ needs.generate-schema.outputs.version }} | |
body: | | |
Automated release of schema version v${{ needs.generate-schema.outputs.version }}. | |
env: | |
GITHUB_TOKEN: ${{ secrets.SCHEMA_REPO_PAT }} |