Skip to content

Commit 926bead

Browse files
committed
ci(docs): manual, main-only docs deploy on demand
Replace the abandoned `stable`-branch deploy (frozen at v0.9.3) with a manual (`workflow_dispatch`) GitHub Pages deploy. Publishing is restricted to `main` by two independent layers: the `github-pages` environment's deployment-branch policy (set to `main` only), and a guard step that fails the run if dispatched from any other ref. So "only what's reviewed and merged to main is published" holds even though workflow_dispatch's branch picker technically offers other branches. Manual (not push-triggered) so publishing is a deliberate act and a failed run can be re-fired without a new commit if the runner is unavailable. test-docs runs the build on any PR touching docs or their linked inputs (filter covers `config.example.toml`, drops `api/**` — the API spec is fetched client-side at runtime, not built in).
1 parent bd19cc6 commit 926bead

2 files changed

Lines changed: 43 additions & 15 deletions

File tree

‎.github/workflows/docs.yml‎

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,46 @@
11
name: Docs
22

3+
# Manual only: click "Run workflow" to publish the docs currently on the
4+
# selected branch (defaults to the repo default branch). Publishing is a
5+
# deliberate act, not a side effect of a merge, and a failed run can simply be
6+
# re-run without pushing a new commit.
37
on:
4-
push:
5-
branches:
6-
- stable
7-
# Review gh actions docs if you want to further define triggers, paths, etc
8-
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
916

1017
jobs:
1118
build:
1219
name: Build Docusaurus
1320
runs-on: ubuntu-latest
1421
steps:
22+
# Publishing is main-only. The github-pages environment enforces this at
23+
# deploy time, but fail loud here too so a mistaken dispatch from another
24+
# branch stops before building instead of silently producing no deploy.
25+
- name: Refuse to publish from a non-main branch
26+
if: github.ref != 'refs/heads/main'
27+
env:
28+
DISPATCHED_REF: ${{ github.ref }}
29+
run: |
30+
echo "::error::Docs publish only from main (dispatched ref: $DISPATCHED_REF)."
31+
exit 1
1532
- uses: actions/checkout@v6
16-
with:
17-
fetch-depth: 0
1833

1934
- uses: actions/setup-node@v4
2035
with:
21-
node-version: 20
36+
node-version: 24
37+
cache: npm
38+
cache-dependency-path: docs/package-lock.json
2239

2340
- name: Install dependencies
24-
run: npm install
41+
# npm ci = reproducible install from package-lock.json (npm install
42+
# re-resolves ranges at run time and can drift between runs)
43+
run: npm ci
2544
working-directory: ./docs
2645

2746
- name: Build website

‎.github/workflows/test-docs.yml‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,33 @@ on:
44
pull_request:
55
branches:
66
- main
7-
# Review gh actions docs if you want to further define triggers, paths, etc
8-
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
7+
paths:
8+
# config.example.toml is linked from docs/ and bundled into the build, so
9+
# a PR that changes or removes it must run the build check
10+
- 'docs/**'
11+
- 'config.example.toml'
12+
- '.github/workflows/test-docs.yml'
13+
- '.github/workflows/docs.yml'
14+
15+
permissions:
16+
contents: read
917

1018
jobs:
1119
test-deploy:
1220
name: Test deployment
1321
runs-on: ubuntu-latest
1422
steps:
1523
- uses: actions/checkout@v6
16-
with:
17-
fetch-depth: 0
1824

1925
- uses: actions/setup-node@v4
2026
with:
21-
node-version: 20
27+
node-version: 24
28+
cache: npm
29+
cache-dependency-path: docs/package-lock.json
2230

2331
- name: Install dependencies
24-
run: npm install
32+
# npm ci = reproducible install from package-lock.json
33+
run: npm ci
2534
working-directory: ./docs
2635

2736
- name: Test build website

0 commit comments

Comments
 (0)