Switch npm publishing to trusted publishing (OIDC) - #14
Merged
Conversation
Drop NPM_TOKEN from the release workflow and rely on npm trusted publishing instead. changesets/action@v1 (v1.9.0) only writes an ~/.npmrc auth line when NPM_TOKEN is set; without it, it detects the OIDC env vars and lets the npm CLI exchange the id-token itself. @changesets/cli skips its 2FA/whoami path in CI and shells out to `npm publish`, so the exchange happens there. Provenance is still generated automatically, so no --provenance flag is needed. Trusted publishing requires npm >= 11.5.1 and node >= 22.14.0. Node 22.x still ships npm 10.9.x, so both workflows move to node 24 (npm 11.19), and the actions are bumped to v4 while we're here. Also remove the `publish-patch` script: releases are cut by CI, and a manual local `npm publish` would break once trusted publishing is required for the package. Needs a matching Trusted Publisher entry on npmjs.com for @imgproxy/imgproxy-node (repo imgproxy/imgproxy-node, workflow publish.yml) before the next release. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014sCcudHzpuZvLBhZ1U1Uvi
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.
Replaces the long-lived
NPM_TOKENsecret with npm trusted publishing (OIDC).What changed
.github/workflows/publish.ymlNPM_TOKENfrom thechangesets/actionstep env.changesets/action@v1(currently v1.9.0) only writes an~/.npmrcauth line ifNPM_TOKENis set; without it, it detects the OIDC env vars and logsNo NPM_TOKEN found, but OIDC is available - using npm trusted publishing.@changesets/cliskips its 2FA/whoami path in CI and shells out tonpm publish, so the token exchange happens inside the npm CLI.id-token: writewas already present, so no permission changes were needed.--provenanceflag required.actions/setup-node@v3→@v4..github/workflows/ci.ymlactions/checkout@v4/actions/setup-node@v4, to keep CI in sync with the release job.package.jsonpublish-patchscript. Releases are cut by CI via changesets, and a manual localnpm publishbreaks once trusted publishing is required for the package.Required manual step before merging
Configure the trusted publisher on npmjs.com for
@imgproxy/imgproxy-node(Settings → Trusted Publisher):imgproxyimgproxy-nodepublish.ymlWithout this entry the next release publish fails to authenticate. Once the first release publishes successfully, the
NPM_TOKENrepository secret can be deleted.Verification
npm run lint,npm run check-types,vitest run(30 tests) andnpm run buildall pass locally on Node 24.🤖 Generated with Claude Code
https://claude.ai/code/session_014sCcudHzpuZvLBhZ1U1Uvi