Repository navigation
ci: publish via npm trusted publishing (OIDC) instead of a token - #23
Merged
Merged
Conversation
npm has been retiring long-lived automation tokens in response to the 2025 supply-chain worms, so NPM_TOKEN is not a credential that can be issued any more. Trusted publishing is the replacement and is strictly better here: the credential is minted per-run by GitHub's OIDC provider, scoped to this repository and this workflow FILE, and expires in minutes. There is no long-lived secret in the repo to steal. Two things this fixes beyond the auth itself: - Node is pinned to 24.x and npm is upgraded explicitly. Trusted publishing needs npm >= 11.5.1; Node 22.x still bundles npm 10.x, which fails with a plain auth error giving no hint that the CLI is simply too old. That is the same shape as the ENEEDAUTH we have been chasing, and worth not repeating. - --provenance is removed. Trusted publishing generates provenance attestations automatically, and passing the flag explicitly is not required. Requires a one-time setup on npmjs.com (Package -> Settings -> Trusted Publisher) naming wmantly/jq-repeat and the workflow filename publish.yml. Documented in the workflow header, including that renaming the file breaks publishing until npmjs.com is updated to match. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TnJ9iEHU6m7kYxD5fXPfts
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.
npm has been retiring long-lived automation tokens in response to the 2025 supply-chain worms, so
NPM_TOKENisn't a credential that can be issued any more. Trusted publishing is the replacement, and it's strictly better here: the credential is minted per-run by GitHub's OIDC provider, scoped to this repository and this workflow file, and expires in minutes. There is no long-lived secret in the repo to steal.Beyond the auth itself, two things this fixes
Node pinned to 24.x, npm upgraded explicitly. Trusted publishing requires npm ≥ 11.5.1. Node 22.x — what this workflow pinned — still bundles npm 10.x, which fails with a plain auth error giving no hint that the CLI is simply too old. That's the same shape as the
ENEEDAUTHwe've been chasing; worth not repeating.--provenanceremoved. Trusted publishing generates provenance attestations automatically; the flag is not required.One-time setup needed on npmjs.com
This PR alone does not make publishing work. On npmjs.com, for the
jq-repeatpackage → Settings → Trusted Publisher → GitHub Actions:wmantlyjq-repeatpublish.ymlAll fields are case-sensitive, and the workflow field is the filename, not a path. Renaming the file later breaks publishing until npmjs.com is updated to match — noted in the workflow header so it isn't a surprise.
Once that's saved, the next GitHub Release publishes on its own, with provenance, and no secret anywhere.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TnJ9iEHU6m7kYxD5fXPfts