Skip to content

Commit 5e38aba

Browse files
committed
ci(astro): require Node 24 / npm 11.5.1+ for OIDC publish exchange
Node 22 ships npm 10.x which can sign provenance attestations (sigstore OIDC flow) but doesn't implement the npm-side OIDC trusted-publisher token exchange, so the publish falls through to a missing token auth and 404s. npm added the exchange in 11.5.1; Node 24 ships an 11.x npm by default. Pinning to node-version: '24' guarantees the right npm without needing a separate 'npm install -g npm@latest' step.
1 parent 4f11de3 commit 5e38aba

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/publish-astro.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,27 @@ jobs:
7676
- name: Setup Node
7777
uses: actions/setup-node@v5
7878
with:
79-
node-version: '22'
79+
# Node 24 ships npm 11.x. OIDC publish (the trusted-publisher
80+
# token exchange) requires npm 11.5.1+; npm 10.x (bundled with
81+
# Node 22) can still sign provenance attestations but doesn't
82+
# know how to exchange the OIDC token for an npm publish
83+
# credential — the publish then falls through to a missing
84+
# token auth and 404s. Pinning to Node 24 is the cleanest way
85+
# to guarantee the right npm.
86+
node-version: '24'
8087
# registry-url tells setup-node to write a project-level .npmrc
8188
# that points at npmjs.org. Required for OIDC token exchange.
8289
# Without this, `npm publish` may resolve to a different default
8390
# registry on the runner.
8491
registry-url: 'https://registry.npmjs.org'
8592

93+
- name: Verify npm has OIDC publish support
94+
run: |
95+
NPM_VER=$(npm --version)
96+
echo "npm version: $NPM_VER"
97+
# node -e exits non-zero (and the step fails) if npm <11.5.1.
98+
node -e "const [a,b,c] = process.argv[1].split('.').map(Number); if (a < 11 || (a === 11 && b < 5) || (a === 11 && b === 5 && c < 1)) { console.error('npm '+process.argv[1]+' lacks OIDC trusted-publisher exchange (needs 11.5.1+)'); process.exit(1); }" "$NPM_VER"
99+
86100
- name: Configure git for commit + push
87101
run: |
88102
git config user.name 'github-actions[bot]'

0 commit comments

Comments
 (0)