Skip to content

ci: publish via npm trusted publishing (OIDC) instead of a token - #23

Merged
wmantly merged 1 commit into
masterfrom
ci/trusted-publishing
Sep 16, 2026
Merged

wmantly merged 1 commit into
masterfrom
ci/trusted-publishing

Conversation

@wmantly

@wmantly wmantly commented Sep 16, 2026

Copy link
Copy Markdown
Owner

npm has been retiring long-lived automation tokens in response to the 2025 supply-chain worms, so NPM_TOKEN isn'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 ENEEDAUTH we've been chasing; worth not repeating.

--provenance removed. 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-repeat package → Settings → Trusted Publisher → GitHub Actions:

field value
Organization or user wmantly
Repository jq-repeat
Workflow filename publish.yml
Environment (leave empty)

All 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

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
@wmantly
wmantly merged commit b411464 into master Sep 16, 2026
3 checks passed
@wmantly
wmantly deleted the ci/trusted-publishing branch September 16, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant