Skip to content

Commit 8ce5877

Browse files
TMHSDigitalclaude
andcommitted
fix(ci): deploy Pages once per release instead of twice
Every release-worthy push started two Pages deploys: the push itself, then release.yml's dispatch after the version bump, which cancelled the first (8 of the last 9 push runs were cancelled). A gate job now applies release.yml's own commit-subject test to the pushed commits and skips the push deploy when a release will dispatch one. Non-release pushes (docs, chore) and manual dispatches deploy as before. Also adds pages.yml to its own trigger paths, so a change to the deploy workflow deploys. Closes #215 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com>
1 parent e7a555d commit 8ce5877

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎.github/workflows/pages.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ on:
2222
- "scripts/build_gallery.py"
2323
- "scripts/site/**"
2424
- "CHANGELOG.md"
25+
- ".github/workflows/pages.yml"
2526
workflow_dispatch:
2627

2728
permissions:
@@ -33,7 +34,34 @@ concurrency:
3334
cancel-in-progress: true
3435

3536
jobs:
37+
# A push that will cut a release gets its deploy from release.yml, which dispatches
38+
# this workflow after committing the version bump. Deploying on the push too only
39+
# built a page that the dispatch then cancelled (8 of 9 push runs measured, #215).
40+
# The pattern mirrors release.yml's "Determine bump type" step exactly. If that
41+
# release fails, redeploy by hand: Actions > Deploy GitHub Pages > Run workflow.
42+
gate:
43+
runs-on: ubuntu-latest
44+
outputs:
45+
deploy: ${{ steps.decide.outputs.deploy }}
46+
steps:
47+
- id: decide
48+
env:
49+
EVENT: ${{ github.event_name }}
50+
COMMITS: ${{ toJSON(github.event.commits) }}
51+
run: |
52+
deploy=true
53+
if [ "$EVENT" = "push" ] && echo "$COMMITS" \
54+
| jq -r '.[].message | split("\n")[0]' \
55+
| grep -qiE '^(feat|feature|fix)(\(.+\))?!?:|BREAKING[ -]CHANGE'; then
56+
deploy=false
57+
echo "Release-worthy push: release.yml dispatches Pages after the version bump."
58+
fi
59+
echo "deploy=$deploy" >> "$GITHUB_OUTPUT"
60+
echo "deploy=$deploy"
61+
3662
build-and-deploy:
63+
needs: gate
64+
if: needs.gate.outputs.deploy == 'true'
3765
environment:
3866
name: github-pages
3967
url: ${{ steps.deployment.outputs.page_url }}

0 commit comments

Comments
 (0)