Skip to content

chore(ci): migrate npm publish to trusted publishing (OIDC) - #7

Merged
just-shane merged 1 commit into
mainfrom
chore/npm-trusted-publishing
Aug 11, 2026
Merged

just-shane merged 1 commit into
mainfrom
chore/npm-trusted-publishing

Conversation

@just-shane

Copy link
Copy Markdown
Contributor

npm's token crackdown killed the classic automation token this workflow used (`NPM_TOKEN`). This migrates auth to npm Trusted Publishing:

  • No secret at all — the job mints a short-lived OIDC token (`id-token: write`) that npm matches against the trusted publisher configured on npmjs.com.
  • Node 20 → 22, npm upgraded to ≥ 11.5.1 (trusted-publishing minimums).
  • `--provenance` flag dropped — attestation is automatic on OIDC publishes from public repos.

Before the next release (one-time, needs the npm account):

  1. npmjs.com → `@capitoltrace/congress-api` → Settings → Trusted Publisher → GitHub Actions → org `CapitolTrace`, repo `congress-api`, workflow `publish.yml`, allowed action `npm publish`.
  2. Same Settings page → Publishing access → "Require two-factor authentication and disallow tokens" (trusted publishers are unaffected — this closes the token door completely).
  3. Delete the now-unused `NPM_TOKEN` secret from this repo.

🤖 Generated with Claude Code

npm revoked classic automation tokens and removed the 2FA-exempt token
path, so the NPM_TOKEN this workflow authenticated with is dead. Auth now
comes from npm Trusted Publishing: the job's OIDC token is exchanged for
short-lived publish credentials, matched against the trusted publisher
configured on npmjs.com (this repo + publish.yml).

- drop NODE_AUTH_TOKEN / NPM_TOKEN entirely
- node 20 -> 22 and npm upgraded to >= 11.5.1 (trusted-publishing minimums)
- drop the explicit --provenance flag: attestation is automatic on OIDC
  publishes from a public repo

Requires one-time npmjs.com setup before the next release (package
Settings -> Trusted Publisher -> GitHub Actions: CapitolTrace /
congress-api / publish.yml), then the NPM_TOKEN repo secret can be
deleted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@just-shane
just-shane merged commit 5e6bddb into main Aug 11, 2026
6 checks passed
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