ci: publish to npm via trusted publishing - #172
Merged
Merged
Conversation
npm already has this repo + npm-publish.yml registered as the trusted publisher, but nothing in CI asked for an OIDC claim, so publishes still used NPM_TOKEN — which expired 90 days after it was last set and failed 5.6.0-beta.1 with a 404 on PUT. Three things were missing, not one: - `id-token: write` on the publish job, and again on the two jobs that call it: a reusable workflow cannot hold a permission its caller lacks, and release-please.yml grants only contents/pull-requests. - npm >= 11.5.1 to do the exchange. Node 22 ships npm 10.9, so the publish job moves to Node 24 (npm 11.19). - `npm publish` rather than `pnpm publish`: pnpm only gained the exchange in v11 and this repo pins 10.17. pnpm still installs and builds. NPM_TOKEN is now unused and can be deleted once a release has gone out this way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
It was https://devicecloud.dev — the marketing site, not a git remote. Trusted publishing auto-enables provenance (npm's oidc.js sets it whenever the provenance config is at its default, the OIDC claim says the repo is public and the package is public — all true here), and the registry checks the generated provenance, which names GITHUB_SERVER_URL/GITHUB_REPOSITORY, against this field. A mismatch is a 422 at publish time; a dry run never sends provenance, so it would not have shown up until the real upload. homepage keeps pointing at devicecloud.dev. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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 already has this repo + npm-publish.yml registered as the trusted publisher, but nothing in CI asked for an OIDC claim, so publishes still used NPM_TOKEN — which expired 90 days after it was last set and failed 5.6.0-beta.1 with a 404 on PUT.
Three things were missing, not one:
id-token: writeon the publish job, and again on the two jobs that call it: a reusable workflow cannot hold a permission its caller lacks, and release-please.yml grants only contents/pull-requests.npm publishrather thanpnpm publish: pnpm only gained the exchange in v11 and this repo pins 10.17. pnpm still installs and builds.NPM_TOKEN is now unused and can be deleted once a release has gone out this way.
What & why
Type of change
fix— bug fixfeat— new featureperf— performance improvementrefactor— code change that's neither a fix nor a featuredocs— documentation onlychore/ci/build/test— tooling, no user-facing change!or PR notes aBREAKING CHANGE:)Checklist
pnpm lintpassespnpm typecheckpassespnpm buildpassesCHANGELOG.md(release-please handles this)README.md/STYLE_GUIDE.mdupdated if behaviour or output changedHow to test