test_push_to_branch #1
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: "TEST: On Push to Test Branch" | |
| # ============================================================================ | |
| # SANDBOX TEST WORKFLOW - Phase 8A | |
| # Mirrors on-push-master.yml but tracks test-auto-generate branch and test | |
| # directories. Publish/release jobs echo success instead of real actions. | |
| # Incorporates fix for Issue 6 (env block for commit message). | |
| # DELETE THIS FILE after Phase 8A testing is complete. | |
| # ============================================================================ | |
| on: | |
| push: | |
| branches: [test-auto-generate] | |
| paths: | |
| - 'test-v20111101/**' | |
| - 'test-v20250224/**' | |
| repository_dispatch: | |
| types: [test_push_to_branch] | |
| jobs: | |
| # Check for skip-publish flag in commit message | |
| # *** ISSUE 6 FIX: Uses env block instead of inline interpolation *** | |
| 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: | | |
| echo "π Commit message: $COMMIT_MSG" | |
| 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 test API versions were modified in this push | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| test_v20111101: ${{ steps.filter.outputs.test_v20111101 }} | |
| test_v20250224: ${{ steps.filter.outputs.test_v20250224 }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: dorny/paths-filter@v2 | |
| id: filter | |
| with: | |
| filters: | | |
| test_v20111101: | |
| - 'test-v20111101/**' | |
| test_v20250224: | |
| - 'test-v20250224/**' | |
| # Simulated publish and release for each version conditionally | |
| # Same conditional structure as production but echoes success instead of real npm publish/GitHub release | |
| publish-test-v20111101: | |
| needs: [check-skip-publish, detect-changes] | |
| if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.test_v20111101 == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: test-auto-generate | |
| - name: Simulate publish | |
| run: | | |
| VERSION=$(jq -r '.version' ./test-v20111101/package.json) | |
| echo "============================================" | |
| echo "β PUBLISH SUCCESS (simulated)" | |
| echo " Package: mx-platform-node@$VERSION" | |
| echo " Directory: test-v20111101/" | |
| echo " Would run: npm publish from test-v20111101/" | |
| echo "============================================" | |
| release-test-v20111101: | |
| needs: [check-skip-publish, detect-changes, publish-test-v20111101] | |
| if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.test_v20111101 == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: test-auto-generate | |
| - name: Simulate release | |
| run: | | |
| VERSION=$(jq -r '.version' ./test-v20111101/package.json) | |
| echo "============================================" | |
| echo "β RELEASE SUCCESS (simulated)" | |
| echo " Tag: v$VERSION" | |
| echo " Directory: test-v20111101/" | |
| echo " Would create: GitHub release for v$VERSION" | |
| echo "============================================" | |
| delay-for-test-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-test-v20250224: | |
| needs: [check-skip-publish, detect-changes, delay-for-test-v20250224] | |
| if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.test_v20250224 == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: test-auto-generate | |
| - name: Simulate publish | |
| run: | | |
| VERSION=$(jq -r '.version' ./test-v20250224/package.json) | |
| echo "============================================" | |
| echo "β PUBLISH SUCCESS (simulated)" | |
| echo " Package: mx-platform-node@$VERSION" | |
| echo " Directory: test-v20250224/" | |
| echo " Would run: npm publish from test-v20250224/" | |
| echo "============================================" | |
| release-test-v20250224: | |
| needs: [check-skip-publish, detect-changes, publish-test-v20250224] | |
| if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.test_v20250224 == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: test-auto-generate | |
| - name: Simulate release | |
| run: | | |
| VERSION=$(jq -r '.version' ./test-v20250224/package.json) | |
| echo "============================================" | |
| echo "β RELEASE SUCCESS (simulated)" | |
| echo " Tag: v$VERSION" | |
| echo " Directory: test-v20250224/" | |
| echo " Would create: GitHub release for v$VERSION" | |
| echo "============================================" |