automated_push_to_master #12
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: On Push to Master | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - 'v20111101/**' | |
| - 'v20250224/**' | |
| repository_dispatch: | |
| types: [automated_push_to_master] | |
| jobs: | |
| # Check for skip-publish flag in commit message. This allows skipping publish/release for specific scenarios, | |
| # such as testing generated code, migrating files to new paths, etc. | |
| check-skip-publish: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| skip_publish: ${{ steps.check.outputs.skip_publish }} | |
| steps: | |
| - name: Check for [skip-publish] flag in commit message | |
| id: check | |
| env: | |
| COMMIT_MSG: ${{ github.event.head_commit.message }} | |
| run: | | |
| if [[ "$COMMIT_MSG" == *"[skip-publish]"* ]]; then | |
| echo "skip_publish=true" >> $GITHUB_OUTPUT | |
| echo "🚫 [skip-publish] flag detected - skipping all publish/release jobs" | |
| else | |
| echo "skip_publish=false" >> $GITHUB_OUTPUT | |
| echo "✅ No skip flag - proceeding with publish/release" | |
| fi | |
| # Detect which API versions were modified | |
| # Uses dorny/paths-filter to check which version directories changed. | |
| # For push events: paths-filter uses github.event.before/after automatically. | |
| # For repository_dispatch events: both push and dispatch target master (same branch), | |
| # so we compare HEAD against HEAD~1 to detect changes from the just-pushed commit. | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| v20111101: ${{ steps.filter.outputs.v20111101 }} | |
| v20250224: ${{ steps.filter.outputs.v20250224 }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: dorny/paths-filter@v2 | |
| id: filter | |
| with: | |
| base: ${{ github.event_name == 'repository_dispatch' && 'HEAD~1' || '' }} | |
| filters: | | |
| v20111101: | |
| - 'v20111101/**' | |
| v20250224: | |
| - 'v20250224/**' | |
| # Publish and release for each version conditionally | |
| # Only runs if [skip-publish] flag is NOT present AND files for that version were modified | |
| publish-v20111101: | |
| needs: [check-skip-publish, detect-changes] | |
| if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.v20111101 == 'true' | |
| uses: ./.github/workflows/publish.yml | |
| with: | |
| version_directory: v20111101 | |
| secrets: inherit | |
| release-v20111101: | |
| needs: [check-skip-publish, detect-changes, publish-v20111101] | |
| if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.v20111101 == 'true' | |
| uses: ./.github/workflows/release.yml | |
| with: | |
| version_directory: v20111101 | |
| secrets: inherit | |
| delay-for-v20250224: | |
| runs-on: ubuntu-latest | |
| needs: [check-skip-publish, detect-changes] | |
| if: needs.check-skip-publish.outputs.skip_publish == 'false' | |
| steps: | |
| - name: Brief delay to stagger v20250224 publish | |
| run: sleep 2 | |
| publish-v20250224: | |
| needs: [check-skip-publish, detect-changes, delay-for-v20250224] | |
| if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.v20250224 == 'true' | |
| uses: ./.github/workflows/publish.yml | |
| with: | |
| version_directory: v20250224 | |
| secrets: inherit | |
| release-v20250224: | |
| needs: [check-skip-publish, detect-changes, publish-v20250224] | |
| if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.v20250224 == 'true' | |
| uses: ./.github/workflows/release.yml | |
| with: | |
| version_directory: v20250224 | |
| secrets: inherit | |
| # Notify on failure of orchestration jobs (check-skip-publish, detect-changes, delay). | |
| # Publish and release workflows have their own Slack notifications, so we only | |
| # monitor the jobs owned by this workflow to avoid double-alerting. | |
| slack-notification: | |
| runs-on: ubuntu-latest | |
| needs: [check-skip-publish, detect-changes, delay-for-v20250224] | |
| if: always() && (needs.check-skip-publish.result == 'failure' || needs.detect-changes.result == 'failure' || needs.delay-for-v20250224.result == 'failure') | |
| steps: | |
| - name: Slack notification | |
| uses: ravsamhq/notify-slack-action@v2 | |
| with: | |
| status: failure | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| notification_title: "{repo}: {workflow} workflow" | |
| message_format: "{emoji} *<{workflow_url}|{workflow}>* {status_message} in <{repo_url}|{repo}>" | |
| notify_when: "failure" | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |