ci: publish to npm via OIDC trusted publishing#90
Merged
Conversation
npm granular access tokens have a max expiry and the classic non-expiring automation tokens are being deprecated, so the NPM_TOKEN secret silently broke publishing overnight. Switch to npm Trusted Publishing (OIDC): npm mints a short-lived, workflow-scoped token at run time — nothing to expire or rotate. Requires a Trusted Publisher configured on npmjs.com (repo lenneTech/cli, workflow publish.yml). Bumps Node 20 -> 22 and upgrades npm to >= 11.5.1 (OIDC support landed in 11.5.1), adds `id-token: write`, drops the JS-DevTools/npm-publish action + NPM_TOKEN in favour of plain `npm publish`. Adds workflow_dispatch so a release can be re-published without recreating the GitHub Release. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Why
npm granular access tokens have a max expiry and classic non-expiring automation tokens are being deprecated. The
NPM_TOKENsecret expired and silently broke the 1.24.1 publish (404 on PUT). Rotating a token just resets the timer.What
Switch the Publish workflow to npm Trusted Publishing (OIDC) — npm mints a short-lived, workflow-scoped token at run time. No
NPM_TOKENsecret, nothing to expire or rotate.permissions: id-token: writenpm install -g npm@latest(OIDC support landed in npm 11.5.1)JS-DevTools/npm-publish@v3+secrets.NPM_TOKEN→ plainnpm publishworkflow_dispatchso an existing release can be (re-)published without recreating the GitHub ReleasePrerequisite (done)
A Trusted Publisher is configured on npmjs.com for
@lenne.tech/cli→ repolenneTech/cli, workflowpublish.yml.🤖 Generated with Claude Code