ci: switch npm publish to trusted publishing (OIDC) - #9
Merged
Conversation
- Drop NPM_TOKEN from the semantic-release env; npm CLI 11.5.1+ picks
up the GitHub Actions OIDC token automatically and exchanges it for
a short-lived publish credential when a Trusted Publisher is
configured on npmjs.com for the package.
- Pin `npm install -g npm@latest` (Node 22 image ships npm 10.x, which
predates OIDC support).
- Enable NPM_CONFIG_PROVENANCE so the published tarball carries a
sigstore provenance attestation.
Requires (one-time, on npmjs.com):
Package agentbrain -> Settings -> Trusted publishers ->
Add GitHub Actions publisher:
Repository owner: nextlevelbuilder
Repository name: agentbrain-cli
Workflow: release.yml
Environment: (leave blank)
After this PR merges, the NPM_TOKEN repo secret can be deleted.
npm blocked "agentbrain" (E403, name too similar to existing "agent-brain"). Renamed to "agentbrain-cli" and manually published 1.0.0 to reserve the name. CLI binary command remains `agentbrain` (unchanged in bin field).
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.
Summary
npm deprecated classic long-lived tokens. Switch this repo's release pipeline to Trusted Publishing (OIDC) — no `NPM_TOKEN` secret, no rotation, per-run short-lived credential, and free sigstore provenance.
Workflow changes
One-time setup on npmjs.com (DO NOT merge before this is done)
Package `agentbrain` → Settings → Trusted publishers → Add trusted publisher → GitHub Actions:
If `agentbrain` hasn't been reserved on npm yet, create it first via `Packages` → `New package` (or reserve through this Trusted Publishers form if the UI allows).
After merge
Rollback
Revert this PR + re-add `NPM_TOKEN` (classic or GAT).