Skip to content

ci: publish to npm via trusted publishing instead of a stored token - #549

Merged
ubugeeei merged 2 commits into
mainfrom
ci/npm-trusted-publishing
Aug 6, 2026
Merged

ci: publish to npm via trusted publishing instead of a stored token#549
ubugeeei merged 2 commits into
mainfrom
ci/npm-trusted-publishing

Conversation

@ubugeeei

@ubugeeei ubugeeei commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

The crates.io job has used trusted publishing for a while. The two npm jobs had not — they set //registry.npmjs.org/:_authToken from secrets.NPM_TOKEN and only used id-token: write to attest provenance. A long-lived npm credential with publish rights across the whole scope was sitting in the repository's secrets, which is precisely what trusted publishing removes.

The change

Dropping the token is the whole thing. npm 11.5.1+ detects the Actions OIDC token itself, exchanges it for a short-lived publish credential, and generates provenance automatically on that path.

  • Removed env.NODE_AUTH_TOKEN and the npm config set …_authToken line from both npm jobs
  • npm install -g npm@11npm@11.19.0, an exact pin (zizmor's adhoc-packages audit rejects ranges) above the 11.5.1 that behavior actually requires
  • Kept the --provenance flags: redundant under trusted publishing, but they keep the intent visible and publishConfig.provenance requests it regardless

The npm environment is now load-bearing rather than decorative — a trusted publisher entry names the repository, the workflow file, and the environment, so renaming any of the three stops publishing until every package's entry is updated. Both facts are commented where they appear.

Required setup before the next tag

This does not work until each package has a trusted publisher entry on npmjs.com pointing at this repo, .github/workflows/publish.yml, and the npm environment:

  • @ox-content/napi, @ox-content/islands, @ox-content/vite-plugin, @ox-content/unplugin
  • @ox-content/vite-plugin-{vue,react,svelte,solid}
  • @ox-content/wasm
  • each @ox-content/napi-* platform binding package

Once they are in place, NPM_TOKEN can be revoked.

The bootstrap caveat, documented

Trusted publishing cannot create a package that does not exist yet — the publisher entry is configured on the package's settings page, so the package has to be there first. Same shape as the crates.io restriction already documented below it.

release.md now covers that step for npm, including the detail that bit during this release: bump every workspace package to the release version before packing, or the tarball pins its @ox-content/* dependencies to the previous version.

This is why @ox-content/vite-plugin-solid still needs one manual publish before v2.82.0 is tagged.

🤖 Generated with Claude Code


View with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled.

The crates.io job has been using trusted publishing for a while, but the two
npm jobs still authenticated with `secrets.NPM_TOKEN` — they set
`//registry.npmjs.org/:_authToken` from it and only used `id-token: write` to
attest provenance. So a long-lived npm credential with publish rights to the
whole scope sat in the repository's secrets, which is the thing trusted
publishing exists to remove.

Dropping the token is the whole change: npm 11.5.1+ detects the Actions OIDC
token on its own, exchanges it for a short-lived publish credential, and
generates provenance automatically on that path. The `npm install -g` pin moves
from `npm@11` to `npm@^11.5.1` to state the version that behavior needs. The
`--provenance` flags stay: they are redundant under trusted publishing but keep
the intent visible, and `publishConfig.provenance` already requests it anyway.

The `npm` environment is now load-bearing rather than decorative. A trusted
publisher entry names the repository, the workflow file, and the environment,
so all three are part of the identity — renaming any of them stops publishing
until every package's entry is updated. Both are called out where they appear.

Trusted publishing cannot create a package that does not exist yet, because the
publisher entry lives on the package's settings page. `release.md` now
documents that bootstrap step for npm alongside the equivalent crates.io one,
including the version-bump-before-pack detail that decides whether the tarball
pins its `@ox-content/*` dependencies to the right release.

Setup this needs before the next tag: a trusted publisher entry per package on
npmjs.com, and `NPM_TOKEN` can be revoked once they are in place.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ubugeeei, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9568b749-4275-46ce-b14d-5c7340844f7d

📥 Commits

Reviewing files that changed from the base of the PR and between a653089 and 29eb340.

📒 Files selected for processing (2)
  • .github/workflows/publish.yml
  • docs/content/release.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread .github/workflows/publish.yml Fixed
Comment thread .github/workflows/publish.yml Fixed
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Aug 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

@ox-content/binding-darwin-arm64

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/binding-darwin-arm64@549

@ox-content/binding-darwin-x64

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/binding-darwin-x64@549

@ox-content/binding-linux-arm64-gnu

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/binding-linux-arm64-gnu@549

@ox-content/binding-linux-arm64-musl

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/binding-linux-arm64-musl@549

@ox-content/binding-linux-x64-gnu

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/binding-linux-x64-gnu@549

@ox-content/binding-linux-x64-musl

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/binding-linux-x64-musl@549

@ox-content/binding-win32-x64-msvc

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/binding-win32-x64-msvc@549

@ox-content/napi

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/napi@549

@ox-content/islands

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/islands@549

@ox-content/unplugin

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/unplugin@549

@ox-content/vite-plugin

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/vite-plugin@549

@ox-content/vite-plugin-react

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/vite-plugin-react@549

@ox-content/vite-plugin-solid

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/vite-plugin-solid@549

@ox-content/vite-plugin-svelte

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/vite-plugin-svelte@549

@ox-content/vite-plugin-vue

npm i https://pkg.pr.new/ubugeeei-prod/ox-content/@ox-content/vite-plugin-vue@549

commit: 29eb340

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Benchmark report

3 runtime rows and 5 bundle rows compared. Comparing base a653089 to head 29eb340.

Runtime

Suite Size Target Base time Head time Head speed (base=100%)
Parse only large @ox-content/napi 0.206 ms 0.226 ms 91.20%
Parse + render large @ox-content/napi 0.235 ms 0.186 ms 126.48%
Parse + render async large @ox-content/napi (async) 0.218 ms 0.250 ms 87.01%

Values are from the large runtime benchmarks. Time is shown in milliseconds to microsecond precision. Head speed is normalized with base = 1.00 (100%); changes within +/-5% are treated as noise.

Competitive Snapshot

Suite Size Target Target ops/sec Next competitor Competitor ops/sec Target speedup
Parse only large @ox-content/napi 4,426 ox-content (native) 8,252 0.54x
Parse + render large @ox-content/napi 5,383 ox-content (native) 5,605 0.96x
Parse + render async large @ox-content/napi (async) 3,999 @astrojs/markdown-remark 7 598.40x

This snapshot uses the head commit and the same input corpus as the regression gate. Higher runtime ops/sec is better.

Environment

Field Base Head
Runner label blacksmith-32vcpu-ubuntu-2404 blacksmith-32vcpu-ubuntu-2404
Runner OS Linux Linux
Runner arch X64 X64
CPU AMD EPYC AMD EPYC
CPU cores 32 32
Memory 113.41 GB 113.41 GB
Node v24.19.0 v24.19.0
Bun 1.3.14 1.3.14
Median runs 5 5
Generated at 2026-08-06T06:23:15.282Z 2026-08-06T06:38:51.084Z

Bundle Size

App Base gzip Head gzip Delta Base requests Head requests Base files Head files
ox-content (bare) 5.8 KB 5.8 KB 0.00% 1 1 5 5
ox-content (default) 27.9 KB 27.9 KB 0.00% 4 4 9 9
ox-content + Vue 50.1 KB 50.1 KB 0.00% 4 4 9 9
VitePress (bare) 46.9 KB 46.9 KB 0.00% 6 6 14 14
VitePress (default) 717.2 KB 717.2 KB 0.00% 21 21 29 29

Bundle size uses gzipped JS/CSS/HTML/JSON assets. Requests estimate index.html plus referenced local initial assets. Lower is better.

Regression Gate

Runtime regressions fail when head throughput is more than 10% slower than base (async rows are informational only; their worker-scheduling variance exceeds the threshold on quiet PRs). Bundle regressions fail when gzipped size grows by more than 5%. Maintainers can intentionally override by applying the benchmark-regression-accepted PR label, which sets OX_CONTENT_BENCHMARK_ALLOW_REGRESSION=1.

No threshold regressions found.

@ubugeeei
ubugeeei merged commit bf62928 into main Aug 6, 2026
37 checks passed
@ubugeeei
ubugeeei deleted the ci/npm-trusted-publishing branch August 6, 2026 06:54
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.

2 participants