Skip to content

Commit b8d1c8a

Browse files
JohnMcLearclaude
andauthored
ci(docs): build on PRs and pin Node 22 (Qodo follow-up to #7640) (#7645)
* ci(docs): build on PRs and pin Node 22 (Qodo follow-up to #7640) Qodo flagged two reliability gaps on the oxc-minify fix that landed in #7640: 1. The Deploy Docs to GitHub Pages workflow only ran on push to develop, so a PR that broke `pnpm run docs:build` was not caught until after merge — exactly how the dead-link regression in #7546 escaped. Add a pull_request trigger that runs the same build but skips the deploy/upload steps via `if: github.event_name == 'push'`. Also include the workflow file itself in the path filter so changes to it are exercised on PR. 2. oxc-minify@0.128.0 requires Node ^20.19.0 || >=22.12.0, but the workflow did not pin Node and the repo declared engines.node >=22.0.0 with engineStrict: true — a runner image (or local dev) on Node 22.0–22.11 would refuse to install. Pin Node 22 in the docs workflow with actions/setup-node@v6 (matching the rest of CI), and bump engines.node to >=22.12.0 so the project's engineStrict gate matches the actual minimum. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci(docs): split build and deploy so PR runs do not hit pages env protection The previous attempt put `if: github.event_name == 'push'` on individual deploy steps but kept the single job's `environment: github-pages` binding. Environment protection rules reject any non-develop ref (including `refs/pull/N/merge`), so the runner failed the entire job at creation time before any step could execute: Branch "refs/pull/7645/merge" is not allowed to deploy to github-pages due to environment protection rules. Split into two jobs: `build` runs on every trigger (PR + push) and uploads the artifact only on push, `deploy` depends on `build`, runs only on push, and is the only job bound to the github-pages environment. Standard GHA pages-deploy pattern; PR builds never attempt to enter the protected environment. * docs: align Node minimum references with bumped engines.node (Qodo round 2 on #7645) Qodo flagged that engines.node moved from >=22.0.0 to >=22.12.0 in this PR but documentation still claimed the old requirement. Sync the three places that pinned a specific minimum: - README.md installation requirements (>= 22 → >= 22.12) - doc/npm-trusted-publishing.md publish prerequisites (>=22.0.0 → >=22.12.0, with oxc-minify cited as the driver) - CHANGELOG.md 2.7.3 breaking-changes entry (22 → 22.12, with the same oxc-minify justification) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d036cf0 commit b8d1c8a

5 files changed

Lines changed: 48 additions & 19 deletions

File tree

.github/workflows/build-and-deploy-docs.yml

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
1-
# Workflow for deploying static content to GitHub Pages
1+
# Workflow for building and deploying the VitePress site to GitHub Pages.
2+
# Build runs on every push to develop and on every PR that touches docs (so
3+
# a build regression is caught at review time instead of breaking develop
4+
# after merge — see #7640). Deploy runs only on push: the github-pages
5+
# environment has protection rules that reject PR refs, and a PR build
6+
# never produced an artifact to deploy anyway.
27
name: Deploy Docs to GitHub Pages
38

49
on:
5-
# Runs on pushes targeting the default branch
610
push:
711
branches: ["develop"]
812
paths:
9-
- doc/** # Only run workflow when changes are made to the doc directory
10-
# Allows you to run this workflow manually from the Actions tab
13+
- doc/**
14+
- .github/workflows/build-and-deploy-docs.yml
15+
pull_request:
16+
paths:
17+
- doc/**
18+
- .github/workflows/build-and-deploy-docs.yml
1119
workflow_dispatch:
1220

13-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1421
permissions:
1522
contents: read
1623
pages: write
1724
id-token: write
1825
packages: read
1926

20-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
27+
# Allow only one concurrent deployment, skipping runs queued between the run
28+
# in-progress and latest queued. Do NOT cancel in-progress runs — production
29+
# deployments are allowed to complete.
2230
concurrency:
2331
group: "pages"
2432
cancel-in-progress: false
2533

2634
jobs:
27-
# Single deploy job since we're just deploying
28-
deploy:
29-
environment:
30-
name: github-pages
31-
url: ${{ steps.deployment.outputs.page_url }}
35+
build:
3236
runs-on: ubuntu-latest
3337
steps:
3438
- name: Checkout
@@ -52,20 +56,44 @@ jobs:
5256
with:
5357
version: 10.33.2
5458
run_install: false
59+
# Pin Node so the build does not silently fall back to whatever the
60+
# runner image ships with. oxc-minify (a vitepress peer when
61+
# rolldown-vite is in use) requires Node ^20.19.0 || >=22.12.0; the
62+
# repo declares engines.node >=22.12.0 to match.
63+
- name: Use Node.js
64+
uses: actions/setup-node@v6
65+
with:
66+
node-version: 22
67+
cache: pnpm
5568
- name: Setup Pages
69+
if: github.event_name == 'push'
5670
uses: actions/configure-pages@v6
5771
- name: Install dependencies
5872
run: pnpm install --frozen-lockfile
5973
- name: Build app
6074
working-directory: doc
6175
run: pnpm run docs:build
6276
env:
77+
GITHUB_PAGES: ${{ github.event_name == 'push' && 'true' || '' }}
6378
COMMIT_REF: ${{ github.sha }}
6479
- name: Upload artifact
80+
if: github.event_name == 'push'
6581
uses: actions/upload-pages-artifact@v5
6682
with:
67-
# Upload entire repository
6883
path: './doc/.vitepress/dist'
84+
85+
# Deploy to GitHub Pages on push to develop only. Kept as a separate job
86+
# because the github-pages environment's protection rules reject any
87+
# non-develop ref (including PR merge refs), which used to fail the entire
88+
# workflow at job-creation time before any build step could run.
89+
deploy:
90+
needs: build
91+
if: github.event_name == 'push'
92+
environment:
93+
name: github-pages
94+
url: ${{ steps.deployment.outputs.page_url }}
95+
runs-on: ubuntu-latest
96+
steps:
6997
- name: Deploy to GitHub Pages
7098
id: deployment
7199
uses: actions/deploy-pages@v5

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### Breaking changes
44

5-
- **Minimum required Node.js version is now 22.** Node.js 20 is reaching end-of-life (see https://nodejs.org/en/about/previous-releases). The CI matrix now targets Node 22, 24, and 25. Upgrading should be straightforward — install a current Node.js release before updating Etherpad.
5+
- **Minimum required Node.js version is now 22.12.** Node.js 20 is reaching end-of-life (see https://nodejs.org/en/about/previous-releases) and the docs build's `oxc-minify` peer requires `^20.19.0 || >=22.12.0`. The CI matrix now targets Node 22, 24, and 25. Upgrading should be straightforward — install a current Node.js release before updating Etherpad.
66

77
### Notable enhancements
88

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ volumes:
160160
161161
### Requirements
162162
163-
[Node.js](https://nodejs.org/) >= 22.
163+
[Node.js](https://nodejs.org/) >= 22.12.
164164
165165
### Windows, macOS, Linux
166166

doc/npm-trusted-publishing.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ If a package previously had an `NPM_TOKEN` secret in CI:
8585

8686
## Requirements
8787

88-
- **Node.js**: >= 22 on the runner. npm 11 requires `>=22.9.0`, which
89-
`setup-node@v6 with version: 22` satisfies (resolves to the latest 22.x).
90-
The project's `engines.node` requires `>=22.0.0`.
88+
- **Node.js**: >= 22.12 on the runner. npm 11 requires `>=22.9.0` and
89+
`oxc-minify` (a vitepress peer for the docs build) requires `>=22.12.0`,
90+
both of which `setup-node@v6 with version: 22` satisfies (resolves to the
91+
latest 22.x). The project's `engines.node` requires `>=22.12.0`.
9192
- **npm CLI**: >= 11.5.1. The publish workflow runs `npm install -g npm@latest`
9293
before publishing so the bundled npm version doesn't matter.
9394
- **Runner**: must be a GitHub-hosted (cloud) runner. Self-hosted runners are

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"ui": "link:ui"
4343
},
4444
"engines": {
45-
"node": ">=22.0.0"
45+
"node": ">=22.12.0"
4646
},
4747
"repository": {
4848
"type": "git",

0 commit comments

Comments
 (0)