ci: switch npm publish to OIDC trusted publishers#23073
Merged
Conversation
Replace token-based npm authentication with OIDC for publishing. This bypasses the 2FA/granular token issues causing 404 errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
CR ✅ |
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.
Context
The npm publish workflow was failing with a 404 error when publishing
@yoast/tailwindcss-preset@2.6.0(failed run). The root cause is the stored npm token being rejected due to 2FA/granular token restrictions on the@yoastnpm org. This follows the same approach used in Yoast/ai-frontend#152 — switching from token-based auth to OIDC trusted publishers.Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
NODE_AUTH_TOKENin the publish step so npm uses OIDC instead of the stored token.--access publicto allnpm publishcommands, required for scoped packages with OIDC.id-token: writepermission andregistry-urlsetup were already in place.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
@yoast/*package as a Trusted Publisher on npm: npmjs.com → package settings → Publishing access → Add trusted publisher → repository:Yoast/wordpress-seo, workflow:.github/workflows/publish-npm-packages.yml.workflow_dispatchwith the PR number of the version increase PR.Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
Other environments
Documentation
Quality assurance
grunt build:imagesand commited the results, if my PR introduces new images or SVGs.Innovation