ci: switch npm publish to OIDC trusted publishing#57
Merged
Conversation
Replace the long-lived NPM_TOKEN with npm trusted publishing (OIDC): - Drop NPM_TOKEN / NODE_AUTH_TOKEN from the changesets publish step; npm authenticates via the existing id-token: write OIDC permission. - Upgrade npm to latest before publish — Node 22 ships npm 10.x but trusted publishing requires npm >= 11.5.1 (also avoids the known OIDC E404 on scoped packages). Requires a trusted publisher configured per package on npmjs.com (org=Contentrain, repo=ai, workflow=release.yml) — done for all four packages. This also removes the token-scope limitation that kept the unscoped `contentrain` CLI from publishing (npm stuck at 0.5.1); the next release on main will publish contentrain@0.5.4 via OIDC.
✅ Deploy Preview for contentrain-ai ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Moves npm publishing from a long-lived
NPM_TOKENto OIDC trusted publishing.Changes (
release.yml)NPM_TOKEN/NODE_AUTH_TOKENfrom the changesets publish step — npm now authenticates via the existingid-token: writeOIDC permission.npm install -g npm@lateststep before publish. Node 22 ships npm 10.x, but trusted publishing requires npm ≥ 11.5.1 (also avoids the known OIDC E404 on scoped packages, OIDC trusted publishing E404 when publishing scoped packages from changesets/action npm/cli#8976).Prerequisite (done)
Trusted publisher configured per package on npmjs.com —
org=Contentrain, repo=ai, workflow=release.yml— for@contentrain/mcp,@contentrain/rules,@contentrain/skills, andcontentrain.Effect
contentrainCLI publish: the old token was scoped to@contentrain/*only, so the CLI 403d and npm stayed at0.5.1(repo is at0.5.4). OIDC identity is per-workflow, not per-scope.changeset publish, which will publishcontentrain@0.5.4via OIDC and close the version gap.Follow-up
Once the first OIDC release is confirmed green, the npm granular
NPM_TOKENand its GitHub secret can be deleted.