Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ jobs:
# deploy + verify; its status shows on its own run rather than this tag's CI, which
# is fine — a tag has no PR to annotate. (Consumers do the same by dispatching their
# fork-preview wrapper instead — see the how-to.)
publish-tag:
needs: [lint, test, docs, release]
if: >-
github.repository == 'DiamondLightSource/myst-version-switcher-plugin' &&
github.ref_type == 'tag'
runs-on: ubuntu-latest
permissions:
actions: write # dispatch publish.yml
steps:
- name: Re-deploy via workflow_dispatch (tag trampoline)
env:
GH_TOKEN: ${{ github.token }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
gh workflow run publish.yml --repo "$GITHUB_REPOSITORY" --ref "$DEFAULT_BRANCH"
# publish-tag:
# needs: [lint, test, docs, release]
# if: >-
# github.repository == 'DiamondLightSource/myst-version-switcher-plugin' &&
# github.ref_type == 'tag'
# runs-on: ubuntu-latest
# permissions:
# actions: write # dispatch publish.yml
# steps:
# - name: Re-deploy via workflow_dispatch (tag trampoline)
# env:
# GH_TOKEN: ${{ github.token }}
# DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
# run: |
# gh workflow run publish.yml --repo "$GITHUB_REPOSITORY" --ref "$DEFAULT_BRANCH"
20 changes: 12 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,14 @@ jobs:
# a gh-pages→Actions cutover froze the origin while every deploy reported OK).
# The caller's tag trampoline (deploy via workflow_dispatch) prevents the
# tag-after-merge drop; this is the backstop that turns any *other* stale-origin
# failure into a red check instead of silently serving old docs. Confirm the
# live switcher.json
# byte-matches the one we just assembled, polling up to 60s for the origin/CDN
# to propagate; on failure, dump the origin headers (a frozen etag/last-modified
# is the wedge signature).
# failure into a red check instead of silently serving old docs. Confirm the live
# switcher.json byte-matches the one we just assembled, polling up to ~6 min — the
# window is generous because a release deploys TWICE in quick succession on the
# same SHA (the merge-to-default-branch push, then the tag trampoline), and the
# second (dispatch) re-serve can take a few minutes to propagate to the origin
# behind the first (observed ~4 min on 2026-06-25). The loop exits the instant the
# origin matches, so a fast/first-of-SHA deploy isn't slowed. On failure, dump the
# origin headers (a frozen etag/last-modified is the wedge signature).
- name: Verify the deployed origin matches what we assembled
env:
PAGE_URL: ${{ steps.deployment.outputs.page_url }}
Expand All @@ -187,7 +190,8 @@ jobs:
# comparison is robust to a curl/file trailing-newline difference.
want=$(cat "$local_json")
url="${PAGE_URL%/}/switcher.json"
deadline=$(( $(date +%s) + 60 ))
timeout_s=360
deadline=$(( $(date +%s) + timeout_s ))
attempt=0
while :; do
attempt=$((attempt + 1))
Expand All @@ -197,12 +201,12 @@ jobs:
exit 0
fi
if [ "$(date +%s)" -ge "$deadline" ]; then
echo "::error::live switcher.json still does not match the assembled one after 60s — Pages origin likely stale/wedged"
echo "::error::live switcher.json still does not match the assembled one after ${timeout_s}s — Pages origin likely stale/wedged"
echo "--- origin headers (frozen etag/last-modified ⇒ wedged) ---"
curl -sI "$url?cb=$(date +%s%N)" | grep -iE '^(HTTP/|etag|last-modified|age)' | tr -d '\r'
echo "--- assembled ($local_json) ---"; printf '%s\n' "$want"
echo "--- live ($url) ---"; printf '%s\n' "$got"
exit 1
fi
sleep 1
sleep 5
done
Loading