Skip to content

Commit b4d3a6f

Browse files
cliffhallclaude
andcommitted
ci(release): publish with Node 24's bundled npm instead of installing one
OIDC trusted publishing needs npm >= 11.5.1, and Node 22 bundles npm 10.x, so publish-npm installed [email protected] next to id-token: write. It now runs an exactly pinned Node 24.21.0, whose bundled npm (11.19.0) meets the floor, and installs nothing; a step fails the job before publishing if the bundled npm is ever below 11.5.1. The build jobs keep Node 22. The release skill's note on pinning moves from the npm CLI to the Node release. Closes #5104 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 5429925 commit b4d3a6f

2 files changed

Lines changed: 29 additions & 10 deletions

File tree

‎.claude/skills/release/SKILL.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,5 +568,9 @@ ACTION=actions/checkout TAG=v6.1.0
568568
echo "uses: $ACTION@$(gh api "repos/$ACTION/commits/$TAG" --jq .sha) # $TAG"
569569
```
570570

571-
The same goes for the npm CLI the publish job installs (`[email protected]` in
572-
`release.yml`): it is pinned exactly, and bumped deliberately.
571+
The same goes for the Node release the npm publish job runs (`node-version` in
572+
`publish-npm`, `release.yml`): it is pinned exactly, because its bundled npm is
573+
the CLI that publishes, and it stays on a release whose bundled npm is 11.5.1
574+
or later (the OIDC floor; the job checks it before publishing). Bump it
575+
deliberately, from a Node release whose npm version you have read in
576+
`https://nodejs.org/dist/index.json`.

‎.github/workflows/release.yml‎

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,33 @@ jobs:
213213
steps:
214214
# No `cache: npm`: there is no checkout, so no lockfile to key it on, and
215215
# nothing here installs dependencies to cache.
216+
# OIDC trusted publishing requires npm >= 11.5.1. Node 22 bundles npm
217+
# 10.x, so this job runs Node 24, whose bundled npm meets the floor, and
218+
# installs nothing: no package is fetched from the registry and run
219+
# next to `id-token: write` (#5104). Pinned EXACTLY, not to a major: the
220+
# runtime is the one thing this job trusts besides the pinned actions,
221+
# and a range would let whatever 24.x is current at release time in.
222+
# The build jobs keep Node 22; this job only reads a manifest and runs
223+
# `npm publish` on the verified tarball.
216224
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
217225
with:
218-
node-version: 22
226+
node-version: 24.21.0
219227
registry-url: "https://registry.npmjs.org"
220228

221-
# OIDC trusted publishing requires npm >= 11.5.1; Node 22's bundled npm
222-
# is 10.x. Pinned EXACTLY, not to a range: this install runs in the job
223-
# that holds `id-token: write`, so it is the one package this job
224-
# trusts, and a range would let whatever 11.x is current at release time
225-
# into it. `--ignore-scripts` keeps even its lifecycle scripts out.
226-
- name: Install the pinned npm CLI (OIDC trusted publishing)
227-
run: npm install -g --ignore-scripts [email protected]
229+
# Fails closed before anything is published if the bundled npm is ever
230+
# below the OIDC floor (a different Node pin, or a runner override).
231+
- name: Check the bundled npm supports OIDC trusted publishing
232+
run: |
233+
NPM_VERSION="$(npm --version)"
234+
echo "node $(node --version), npm $NPM_VERSION"
235+
node -e '
236+
const [a, b, c] = process.argv[1].split(".").map(Number);
237+
const ok = a > 11 || (a === 11 && (b > 5 || (b === 5 && c >= 1)));
238+
if (!ok) {
239+
console.error("npm " + process.argv[1] + " is below 11.5.1, the floor for OIDC trusted publishing");
240+
process.exit(1);
241+
}
242+
' "$NPM_VERSION"
228243
229244
- name: Download the artifact built by the build job
230245
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1

0 commit comments

Comments
 (0)