Skip to content

ci(publish): NPM_TOKEN bootstrap for first publish, OIDC after - #43

Merged
lex00 merged 1 commit into
mainfrom
ci/publish-bootstrap-token
Jun 19, 2026
Merged

ci(publish): NPM_TOKEN bootstrap for first publish, OIDC after#43
lex00 merged 1 commit into
mainfrom
ci/publish-bootstrap-token

Conversation

@lex00

@lex00 lex00 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Corrects #42. I verified the npm constraint against the docs and it changes the answer.

The constraint (verified)

npm trusted publishing (OIDC) can only be configured after a package already exists — both the web UI and the npm trust CLI require it (npm/cli#8544). So the first publish of a brand-new github-warden cannot use OIDC — it needs a token exactly once. Pure-OIDC (#42) would fail the inaugural publish.

Fix

The publish job now does token-bootstrap → OIDC-forever:

  • NPM_TOKEN secret present → writes .npmrc and publishes with it (the one-time bootstrap).
  • secret absent → publishes via OIDC trusted publishing (every release after).

Both paths keep --provenance and the idempotency skip.

The bootstrap (3 steps, documented in the README)

  1. Add an NPM_TOKEN repo/org secret (npm granular token, publish scope) → just release minor → publishes 0.2.0, creating the package.
  2. npm trust github github-warden --repo=intentius/github-warden --file=publish.yml --allow-publish (or the npm web UI).
  3. Delete the NPM_TOKEN secret — future just release runs are token-free OIDC.

Verification

  • publish.yml valid YAML; publish step passes bash -n.
  • No source changes.

🤖 Generated with Claude Code

Verified against npm docs: trusted publishing can only be configured
AFTER a package exists (both the web UI and `npm trust` require it), so a
brand-new package's first publish cannot use OIDC — it needs a token
once. The publish job uses an NPM_TOKEN secret when present (first
release) and falls through to OIDC when absent (every release after the
trusted-publisher record is set + the secret deleted). README documents
the 3-step bootstrap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lex00
lex00 merged commit 19b3141 into main Jun 19, 2026
2 checks passed
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