@@ -354,6 +354,10 @@ jobs:
354354 contents : write
355355 id-token : write
356356 attestations : write
357+ # Needed to start the GitHub Pages rebuild after the release is public
358+ # (#370). Pages cannot be started by the release event itself, because
359+ # GITHUB_TOKEN events do not trigger other workflows.
360+ actions : write
357361
358362 steps :
359363 # GoReleaser and gh take the token from the environment, so the checkout
@@ -426,6 +430,35 @@ jobs:
426430 shell : bash
427431 run : gh release edit "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" --draft=false
428432
433+ # pages.yml has a `release: published` trigger, but GitHub does not start a
434+ # workflow for an event caused by GITHUB_TOKEN, so a GoReleaser publish
435+ # never fires it (#370). Start the rebuild directly. It checks out main and
436+ # the header reads the latest release from the Pages metadata, so the site
437+ # shows the tag that was just published.
438+ - name : Rebuild GitHub Pages
439+ env :
440+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
441+ shell : bash
442+ run : |
443+ set -euo pipefail
444+ before=$(date -u -d '10 seconds ago' +%Y-%m-%dT%H:%M:%SZ)
445+ gh workflow run "GitHub Pages" --repo "${GITHUB_REPOSITORY}" --ref main
446+ run_id=""
447+ for _ in $(seq 1 10); do
448+ run_id=$(gh run list --repo "${GITHUB_REPOSITORY}" --workflow "GitHub Pages" \
449+ --event workflow_dispatch --limit 10 --json databaseId,createdAt \
450+ | jq -r --arg before "$before" '[.[] | select(.createdAt > $before)][0].databaseId // empty')
451+ if [ -n "${run_id}" ]; then
452+ break
453+ fi
454+ sleep 3
455+ done
456+ if [ -z "${run_id}" ]; then
457+ echo "GitHub Pages workflow run did not start" >&2
458+ exit 1
459+ fi
460+ gh run watch "${run_id}" --repo "${GITHUB_REPOSITORY}" --exit-status
461+
429462 # Publishes a multi-arch image to GHCR once the release itself is public
430463 # (#40). The Dockerfile cross-compiles in a build-platform builder stage, so
431464 # arm64 needs no QEMU. `latest` only moves for non-prerelease tags.
0 commit comments