fix(ci): drop registry-url from setup-node so wasm publish uses OIDC

The publish step failed with a confusing 404 from registry.npmjs.org
because actions/setup-node@v4 with registry-url auto-writes

  //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
  always-auth=true

into .npmrc. With NODE_AUTH_TOKEN unset (we removed it for Trusted
Publishing) npm sends an empty bearer token instead of falling back
to OIDC, and the registry rejects it as 404 / no permission.

Per npm's Trusted Publishing guidance, npm publish should run with
no token or _authToken settings. Drop registry-url so setup-node
leaves .npmrc untouched and npm can negotiate OIDC.
This commit is contained in:
Jax Liu
2026-05-04 19:04:05 +08:00
parent 4662505e28
commit 9dfe956b9a
+7 -2
View File
@@ -57,9 +57,14 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
# Trusted Publishing requires Node.js >= 22.14.0; pin to 24 (latest LTS line)
# Trusted Publishing requires Node.js >= 22.14.0; pin to 24 (latest LTS line).
# Intentionally do NOT pass registry-url here: setup-node would auto-write
# an .npmrc containing
# //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
# always-auth=true
# which prevents npm from falling back to OIDC, so Trusted Publishing
# fails with a confusing 404 even when correctly configured on npm.
node-version: 24
registry-url: https://registry.npmjs.org
- name: Ensure npm meets Trusted Publishing requirement (>= 11.5.1)
run: npm install -g npm@latest