diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 59ad7d5..d77dcc1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -347,6 +347,10 @@ jobs: contents: write id-token: write attestations: write + # Needed to start the GitHub Pages rebuild after the release is public + # (#370). Pages cannot be started by the release event itself, because + # GITHUB_TOKEN events do not trigger other workflows. + actions: write steps: # GoReleaser and gh take the token from the environment, so the checkout @@ -419,6 +423,35 @@ jobs: shell: bash run: gh release edit "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" --draft=false + # pages.yml has a `release: published` trigger, but GitHub does not start a + # workflow for an event caused by GITHUB_TOKEN, so a GoReleaser publish + # never fires it (#370). Start the rebuild directly. It checks out main and + # the header reads the latest release from the Pages metadata, so the site + # shows the tag that was just published. + - name: Rebuild GitHub Pages + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: | + set -euo pipefail + before=$(date -u -d '10 seconds ago' +%Y-%m-%dT%H:%M:%SZ) + gh workflow run "GitHub Pages" --repo "${GITHUB_REPOSITORY}" --ref main + run_id="" + for _ in $(seq 1 10); do + run_id=$(gh run list --repo "${GITHUB_REPOSITORY}" --workflow "GitHub Pages" \ + --event workflow_dispatch --limit 10 --json databaseId,createdAt \ + | jq -r --arg before "$before" '[.[] | select(.createdAt > $before)][0].databaseId // empty') + if [ -n "${run_id}" ]; then + break + fi + sleep 3 + done + if [ -z "${run_id}" ]; then + echo "GitHub Pages workflow run did not start" >&2 + exit 1 + fi + gh run watch "${run_id}" --repo "${GITHUB_REPOSITORY}" --exit-status + # Publishes a multi-arch image to GHCR once the release itself is public # (#40). The Dockerfile cross-compiles in a build-platform builder stage, so # arm64 needs no QEMU. `latest` only moves for non-prerelease tags. diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 441a9da..00a6c82 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -4,6 +4,11 @@ name: GitHub Pages # header shows the new tag. Docs for a feature that is on main but not # released yet go live with that push; docs/_data/unreleased.yml tags them # "unreleased" until the release (#213). +# +# The `release` trigger below only fires for a release published outside the +# release workflow. GoReleaser publishes with GITHUB_TOKEN, and GitHub does not +# start a workflow for an event caused by that token, so go.yml starts this +# workflow directly after the release is public (#370). on: push: branches: