Skip to content

Commit 6a665de

Browse files
altaywtfclaude
andcommitted
ci: switch back to NPM_TOKEN auth (granular token) — keep provenance
Trusted publishing requires per-package UI setup on npmjs.com, which is fine for one package but doesn't scale across many. Reverting auth to a granular access token while keeping the provenance attestation: - `.github/workflows/ci.yml`: re-add `NPM_TOKEN: ${{ secrets.NPM_TOKEN }}` for auth. Keep `id-token: write` permission — provenance signing uses the OIDC token regardless of auth method. - `publishConfig.provenance: true` stays in `package.json`, so the npm package page still gets the "Built and signed on GitHub Actions" badge linking back to the workflow run. Maintainer setup - npmjs.com → Account → Access Tokens → Generate New → Granular Access Token. Scope: read+write on `react-json-logic` (or a wildcard like `react-json-logic*` / `@uinaf/*` for org-wide reuse). - GH repo → Settings → Secrets → New repository secret `NPM_TOKEN`. Or set as an org-level secret to share across uinaf OSS repos. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4af517f commit 6a665de

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ jobs:
4848
contents: write
4949
issues: write
5050
pull-requests: write
51-
# Required for npm Trusted Publishing (OIDC) — no NPM_TOKEN needed.
52-
# The OIDC token is also used to attach provenance to the published artifact.
51+
# OIDC is used only for npm provenance attestation
52+
# ("Built and signed on GitHub Actions" badge on the npm package page).
53+
# Auth uses NPM_TOKEN (granular access token). Trusted publishing was
54+
# considered but rejected — the per-package npm UI setup doesn't scale
55+
# across many packages.
5356
id-token: write
5457

5558
steps:
@@ -83,6 +86,7 @@ jobs:
8386
conventional-changelog-conventionalcommits
8487
env:
8588
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8690
GIT_AUTHOR_NAME: uinafdev
8791
GIT_AUTHOR_EMAIL: dev@uinaf.dev
8892
GIT_COMMITTER_NAME: uinafdev

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ For per-package work, `cd` into the package dir and run `vp <command>` directly.
4444

4545
Conventional commits drive the version: `feat:` → minor, `fix:` → patch, `feat!:`/`BREAKING CHANGE:` → major. Skip a release with `[skip ci]` in the commit message.
4646

47-
**Auth uses npm Trusted Publishing (OIDC) — no `NPM_TOKEN` secret needed.** The release job carries `id-token: write`; npm validates the OIDC token against the package's [Trusted Publisher](https://docs.npmjs.com/trusted-publishers/) entry. `publishConfig.provenance: true` adds a [provenance attestation](https://docs.npmjs.com/generating-provenance-statements/) to every release.
47+
**Auth uses a granular npm access token** stored as `NPM_TOKEN` in the GH repo (or as an org-level secret, shared across uinaf repos). `publishConfig.provenance: true` adds a [provenance attestation](https://docs.npmjs.com/generating-provenance-statements/) to every release via OIDC — the "Built and signed on GitHub Actions" badge on the npm package page links back to the workflow run.
4848

49-
To enable: on npmjs.com, open the `react-json-logic` package settings → Trusted Publishers → Add → provider GitHub Actions, repository `uinaf/react-json-logic`, workflow filename `ci.yml`. (No environment.) Once configured, every push to `main` that warrants a release publishes automatically with provenance.
49+
Trusted publishing (OIDC-only auth, no token) is the more secure option but requires per-package UI setup on npmjs.com, which doesn't scale across many packages. Granular tokens are the pragmatic middle ground.
5050

5151
Node version is locked in `.node-version` at the workspace root — both CI and the Cloudflare Pages demo deploy read it.
5252

packages/react-json-logic/AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ Auto-published to npm by `.github/workflows/ci.yml` on every push to `main`:
5252
- semantic-release reads `.releaserc.json` from this directory and runs from here via `working_directory: packages/react-json-logic` in the workflow.
5353
- Skip a release on a given push by including `[skip ci]` in the commit message.
5454

55-
**Auth: npm Trusted Publishing (OIDC).** No `NPM_TOKEN` secret. The release job has `id-token: write` permission, GitHub Actions mints a short-lived OIDC token, and npm verifies it against the package's [Trusted Publisher](https://docs.npmjs.com/trusted-publishers/) config. `publishConfig.provenance: true` in `package.json` attaches a [provenance attestation](https://docs.npmjs.com/generating-provenance-statements/) to every published version, so npm shows a "Built and signed on GitHub Actions" badge with a link to the build.
55+
**Auth: granular npm access token.** The release job authenticates with `NPM_TOKEN` (a granular token scoped to this package). Trusted publishing was considered but rejected — npm requires per-package UI setup, which doesn't scale across many packages. `publishConfig.provenance: true` in `package.json` still attaches a [provenance attestation](https://docs.npmjs.com/generating-provenance-statements/) to every published version (provenance uses OIDC for signing only, independent of auth) so npm shows a "Built and signed on GitHub Actions" badge with a link to the build.
5656

57-
`.node-version` at the workspace root locks the runner Node version so CI and the Cloudflare Pages demo (`react-json-logic.uinaf.dev`) agree. Trusted publishing requires npm 11.5.1+, which Node 24.14.0 ships with.
57+
`.node-version` at the workspace root locks the runner Node version so CI and the Cloudflare Pages demo (`react-json-logic.uinaf.dev`) agree.
5858

5959
## Notes for Future Work
6060

0 commit comments

Comments
 (0)