Skip to content

Commit 9e10946

Browse files
committed
fix(ci): deploy the docs site from main after a release, not from the tag
docs.yml had an `on: release` trigger so the /download page could pick up the new assets. It could never work: a release event runs with github.ref = refs/tags/vX.Y.Z, and the github-pages environment allows only `main` to deploy, so the deploy job failed on every stable release. Pre-releases skipped the build entirely, which is why v1.8.0 was the first release to surface it. Replace the trigger with a workflow_dispatch fired by build.yml once the release is published. Dispatching against main satisfies the environment policy and publishes main's docs rather than the release branch snapshot.
1 parent 2bbc188 commit 9e10946

2 files changed

Lines changed: 24 additions & 11 deletions

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,3 +507,15 @@ jobs:
507507
--latest \
508508
--title "$TAG"
509509
fi
510+
511+
- name: Refresh the docs /download page
512+
# Only a stable release changes what /releases/latest resolves to, so a
513+
# pre-release would rebuild the site to byte-identical output.
514+
#
515+
# Dispatched against main on purpose: the github-pages environment only
516+
# permits `main` to deploy, so docs.yml's old `on: release` trigger ran
517+
# with a tag ref and failed its deploy every time. See docs.yml.
518+
if: ${{ steps.release.outputs.is_prerelease == 'false' }}
519+
env:
520+
GH_TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
521+
run: gh workflow run docs.yml --ref main --repo "$GITHUB_REPOSITORY"

.github/workflows/docs.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ on:
1212
- "website/**"
1313
- ".github/workflows/docs.yml"
1414
# The /download page resolves the current release's assets at build time so it
15-
# can link each platform to its actual file. Without this trigger that data
16-
# would freeze at whatever the last website/** change saw, and the page would
17-
# keep serving the previous version's binaries after every release.
18-
# Pre-releases are skipped: /releases/latest ignores them, so the built output
19-
# would be byte-identical.
20-
release:
21-
types: [published]
15+
# can link each platform to its actual file. Without a post-release rebuild that
16+
# data would freeze at whatever the last website/** change saw, and the page
17+
# would keep serving the previous version's binaries after every release.
18+
#
19+
# That rebuild is a `workflow_dispatch` fired by build.yml once the release is
20+
# published, NOT an `on: release` trigger. A release event runs with
21+
# github.ref = refs/tags/vX.Y.Z, and the github-pages environment only allows
22+
# `main` to deploy, so the deploy job failed on every stable release (it never
23+
# surfaced earlier because pre-releases skipped the build entirely). Dispatching
24+
# against main both satisfies that policy and publishes main's docs rather than
25+
# the release branch's older snapshot.
2226
workflow_dispatch:
2327

2428
# Cancel in-flight runs on the same ref so fast follow-up pushes
@@ -34,9 +38,6 @@ jobs:
3438
build:
3539
name: Build site
3640
runs-on: ubuntu-latest
37-
# A pre-release does not change what /releases/latest resolves to, so
38-
# rebuilding for one would burn a run to produce identical output.
39-
if: github.event_name != 'release' || github.event.release.prerelease == false
4041
steps:
4142
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4243
with:
@@ -66,7 +67,7 @@ jobs:
6667
needs: build
6768
if: >-
6869
(github.event_name == 'push' && github.ref == 'refs/heads/main')
69-
|| github.event_name == 'release'
70+
|| (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
7071
environment:
7172
name: github-pages
7273
url: ${{ steps.deployment.outputs.page_url }}

0 commit comments

Comments
 (0)