Skip to content

ci: publish to npm via trusted publishing - #172

Merged
finalerock44 merged 2 commits into
devfrom
fix/npm-trusted-publishing
Sep 17, 2026
Merged

finalerock44 merged 2 commits into
devfrom
fix/npm-trusted-publishing

Conversation

@finalerock44

Copy link
Copy Markdown
Contributor

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.

What & why

Type of change

  • fix — bug fix
  • feat — new feature
  • perf — performance improvement
  • refactor — code change that's neither a fix nor a feature
  • docs — documentation only
  • chore / ci / build / test — tooling, no user-facing change
  • Breaking change (title has ! or PR notes a BREAKING CHANGE:)

Checklist

  • PR title follows the Conventional Commits format (see comment above)
  • pnpm lint passes
  • pnpm typecheck passes
  • pnpm build passes
  • I have not bumped the version or edited CHANGELOG.md (release-please handles this)
  • I have signed the CLA (the bot will prompt on first contribution)
  • Docs / README.md / STYLE_GUIDE.md updated if behaviour or output changed

How to test

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>
@finalerock44 finalerock44 self-assigned this Sep 17, 2026
Comment thread .github/workflows/npm-publish.yml
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>
@claude

claude Bot commented Sep 17, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@finalerock44
finalerock44 merged commit 8a8cc82 into dev Sep 17, 2026
8 checks passed
@finalerock44
finalerock44 deleted the fix/npm-trusted-publishing branch September 17, 2026 15:13
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