|
19 | 19 | permissions: |
20 | 20 | contents: write |
21 | 21 | id-token: write |
| 22 | + actions: write |
22 | 23 | steps: |
23 | 24 | - uses: actions/checkout@v7 |
24 | 25 | with: |
@@ -95,14 +96,29 @@ jobs: |
95 | 96 |
|
96 | 97 | - name: Commit, tag, push |
97 | 98 | if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' |
| 99 | + env: |
| 100 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
98 | 101 | run: | |
99 | 102 | git config user.name "github-actions[bot]" |
100 | 103 | git config user.email "github-actions[bot]@users.noreply.github.com" |
101 | 104 | VERSION=${{ steps.bump.outputs.version }} |
102 | 105 | git add specs/openapi.json src/ README.md AGENTS.md docs/llms-full.txt tests/RoxyApi.Tests/Generated |
103 | 106 | git commit -m "release: v$VERSION" |
104 | 107 | git tag "v$VERSION" |
| 108 | + # Protected main requires the ci-ok context green on every pushed SHA, and a direct push can never carry one. So park the commit on a temp branch, run the real CI there via workflow_dispatch (GITHUB_TOKEN pushes trigger no workflows on their own), and push to main only after it reports green. |
| 109 | + SHA=$(git rev-parse HEAD) |
| 110 | + git push --force origin "HEAD:refs/heads/release-checks" |
| 111 | + gh workflow run ci.yml --ref release-checks |
| 112 | + RUN_ID="" |
| 113 | + for _ in $(seq 1 24); do |
| 114 | + sleep 5 |
| 115 | + RUN_ID=$(gh run list --workflow=ci.yml --branch=release-checks --limit 5 --json databaseId,headSha --jq "[.[] | select(.headSha == \"$SHA\")][0].databaseId // empty") |
| 116 | + [ -n "$RUN_ID" ] && break |
| 117 | + done |
| 118 | + [ -n "$RUN_ID" ] || { echo "dispatched CI run never appeared for $SHA"; exit 1; } |
| 119 | + gh run watch "$RUN_ID" --exit-status |
105 | 120 | git push --follow-tags |
| 121 | + git push origin --delete release-checks || true |
106 | 122 |
|
107 | 123 | - name: Create GitHub release |
108 | 124 | if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' |
|
0 commit comments