Skip to content

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

Merged
WomB0ComB0 merged 1 commit into
mainfrom
ci/npm-trusted-publishing
Aug 21, 2026
Merged

WomB0ComB0 merged 1 commit into
mainfrom
ci/npm-trusted-publishing

Conversation

@WomB0ComB0

Copy link
Copy Markdown
Member

PR Checklist

Overview

The release triggered by merging #1 failed with ERROR Not authenticated with npm, so launchArgs is merged but unpublished. Replaces the expiring token with OIDC trusted publishing.

Before After
npmjs auth NPM_TOKEN written to ~/.npmrc OIDC via id-token: write
Node (pinned) 24.3.0 → npm 11.4.2 24.19.0 → npm 11.17.0
release-it npm checks npm whoami skipped (npm.skipChecks)
Provenance --provenance flag automatic
GitHub Packages GITHUB_TOKEN unchanged

Why each piece

  • Node bump — trusted publishing requires npm ≥ 11.5.1 and Node ≥ 22.14.0. The pinned 24.3.0 ships npm 11.4.2, just under the minimum. 24.5.0 is the first v24 to clear it; 24.19.0 is current LTS. This is in .github/actions/prepare, so it lifts every CI job, not just release.
  • npm.skipChecks — the easy thing to miss. release-it's npm plugin runs npm whoami as a pre-flight check. Under OIDC there is no token for it to answer with, so without this the job fails with the same error message even after the token is gone, which would look like the migration didn't work.
  • Dropping --provenance — npm generates provenance automatically for trusted publishes from public repos. publishConfig.provenance: true stays as a statement of intent.

Requires a manual step before merge

npm can't be configured from CI. On npmjs.com → @elysiumoss/ui-capture → Settings → Trusted Publisher → GitHub Actions:

Field Value
Organization or user ElysiumOSS
Repository ui-capture
Workflow filename release.yml
Environment (leave blank)

All fields are case-sensitive, and npm does not validate them on save — a typo only surfaces as ENEEDAUTH at publish time.

Verification

Both YAML files parse; .release-it.json is valid and Biome-clean. The real test is the publish itself, which can only run post-merge on main — if the trusted publisher config has a typo it will fail with ENEEDAUTH rather than the current Not authenticated.

Follow-up

Once a release goes out green, the NPM_TOKEN repo secret and the corresponding npm token can both be deleted.

The release after #1 failed with "Not authenticated with npm". The
NPM_TOKEN secret was set the same day 0.1.1 shipped and npm granular
tokens cap at 90 days, so it had expired.

Switches npmjs publishing to OIDC trusted publishing so there is no
long-lived credential to expire again:

- Drop the ~/.npmrc token write and the NPM_TOKEN env var. The
  id-token: write permission the workflow already had is what
  authenticates now.
- Bump the pinned Node from 24.3.0 to 24.19.0. Trusted publishing needs
  npm >=11.5.1; 24.3.0 ships 11.4.2, 24.19.0 ships 11.17.0.
- Set npm.skipChecks in .release-it.json. release-it runs `npm whoami`
  before publishing, which has no token to answer with under OIDC and
  would fail identically.
- Drop --provenance from publishArgs; trusted publishing generates
  provenance automatically.

The GitHub Packages step is untouched — it authenticates with
GITHUB_TOKEN against a different registry.

Requires a Trusted Publisher to be configured on npmjs.com for
ElysiumOSS/ui-capture pointing at release.yml.
@WomB0ComB0
WomB0ComB0 merged commit ac03504 into main Aug 21, 2026
13 checks passed
@WomB0ComB0
WomB0ComB0 deleted the ci/npm-trusted-publishing branch August 21, 2026 01:51
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.

Release workflow fails: npm token expired — move to trusted publishing (OIDC)

1 participant