Skip to content

Commit 13de5c2

Browse files
jdevalkclaude
andcommitted
ci: upgrade npm to 11.5.1+ for OIDC trusted publishing
Node 22 ships with npm 10.x, which doesn't support the OIDC trusted-publishing token exchange. Without this upgrade, the next release of @jdevalk/emdash-plugin-seo will fail with ENEEDAUTH even though OIDC is configured on npmjs.com and the publish.yml workflow is set up correctly (id-token: write, no NPM_TOKEN, no NODE_AUTH_TOKEN placeholder). Install npm@latest into a user-local prefix ahead of the existing global npm to sidestep the self-upgrade bug (MODULE_NOT_FOUND: promise-retry). The separate-prefix install was diagnosed and fixed in the seo-graph repo during the seo-graph-core 0.3.0 / astro-seo-graph 0.2.4 release cycle — applying it here preemptively so the next plugin release doesn't hit the same wall. Single-package repo with no workspace deps, so no pnpm pack dance is needed — plain `npm publish` on the fresh npm is sufficient. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9d92458 commit 13de5c2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,20 @@ jobs:
2323
# Leaving it off means no `.npmrc` is created, npm uses the
2424
# default registry (npmjs.org), and trusted publishing can
2525
# authenticate via the GitHub Actions OIDC token.
26+
# Node 22 ships with npm 10.x, which doesn't support OIDC trusted
27+
# publishing. Upgrade to 11.5.1+ so `npm publish` can complete the
28+
# OIDC token exchange with the npm registry. Without this, the
29+
# publish fails with ENEEDAUTH even though OIDC env is available.
30+
#
31+
# Install into a separate global prefix so npm isn't trying to
32+
# upgrade itself in place — that hits a known bug where npm
33+
# removes its own dependencies mid-install and then can't finish
34+
# (MODULE_NOT_FOUND: promise-retry).
35+
- name: Install npm 11.x into a separate prefix
36+
run: |
37+
mkdir -p "$HOME/.npm-global"
38+
npm config set prefix "$HOME/.npm-global"
39+
echo "$HOME/.npm-global/bin" >> "$GITHUB_PATH"
40+
npm install -g npm@latest
41+
"$HOME/.npm-global/bin/npm" --version
2642
- run: npm publish --provenance --access public

0 commit comments

Comments
 (0)