fix(release): don't configure an npm token registry so OIDC trusted publishing can run#237
Merged
Merged
Conversation
setup-node's registry-url injects a job-wide NODE_AUTH_TOKEN and an .npmrc _authToken line. npm trusted publishing (OIDC) only kicks in when no token is configured, so npm was doing a token-based publish (E404) and never attempting OIDC. Drop registry-url; the default registry is already registry.npmjs.org.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #236. The release still failed with
E404(run 28944013848) even thoughid-token: writeis now declared.Looking at the run log, npm never attempted OIDC — it went straight to a token-based
PUTand got 404. The cause:actions/setup-nodewithregistry-url: 'https://registry.npmjs.org'injects a job-wideNODE_AUTH_TOKENenv var (it shows up on every step in the log) and writes an.npmrccontaining//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}. npm's trusted publishing only activates when no auth token is configured, so npm used (empty) token auth and skipped OIDC.Change
Remove
registry-urlfrom thesetup-nodestep. The default registry is alreadyhttps://registry.npmjs.org/, andpublishConfig.access: publicis set inpackage.json, so no token-based.npmrcis needed.In the failed run, the
GITHUB_TOKEN Permissionsgroup listed only:Id-token: writewas requested but not granted, which means OIDC token minting is disabled at the org/enterprise level. Even with this PR, trusted publishing can't work until an admin allows theid-tokenpermission for this repo's Actions. Please also confirm the npm trusted-publisher config (orgreact-native-community, repotemplate, workflowrelease.yaml, environmentnpm-publish).