ci: release workflow publishing via npm trusted publishing - #49
Open
arekkubaczkowski wants to merge 1 commit into
Open
ci: release workflow publishing via npm trusted publishing#49arekkubaczkowski wants to merge 1 commit into
arekkubaczkowski wants to merge 1 commit into
Conversation
Releases needed a TTY: release-it shells out to `npm publish`, npm only offers the browser authorization flow from an interactive terminal, and without one it fails with EOTP asking for a code from an authenticator. Move the whole thing into a manually dispatched workflow. GitHub's OIDC token stands in for npm credentials, so there is nothing to authenticate interactively and no publish token to store — one browser step registers this workflow as the package's trusted publisher and that is the last of it. Provenance comes along for free. The two halves are split because their auth is: release-it does version, commit, tag, push and the GitHub release on GITHUB_TOKEN, then `npm publish` runs on OIDC. `--npm.skipChecks` because release-it's `npm whoami` precheck has no token to check. Also set `git.requireCommits`, which is what stops a stray dispatch from cutting a version with an empty changelog. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
arekkubaczkowski
force-pushed
the
ci/release-workflow
branch
from
August 19, 2026 16:22
284263b to
7d96975
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Releasing 2.1.1 took four attempts, so this removes the part that fought back.
Why it fought
release-it shells out to
npm publish. npm only offers the browser authorization flow when stdin/stdout are a TTY — from a child process it skips straight toEOTPand demands a code from an authenticator app. So the release worked only when run by hand, in a real terminal, in two halves.What this does
A manually dispatched Release workflow, split along the auth boundary:
release-it --no-npm.publish)GITHUB_TOKENnpm publishNo token to store and no interactive second factor:
permissions: id-token: writelets npm exchange the workflow's OIDC token for publish rights on this package. Provenance is generated as a side effect.--npm.skipChecksis needed because release-it'snpm whoamiprecheck has no token to check.Also sets
git.requireCommitsin the release-it config. Without it release-it happily bumps with an empty changelog — a dry run with no commits sincev2.1.1produced a 2.1.2 whose changelog had no entries, which is one stray click away in a dispatch-triggered workflow. With it, that run aborts withThere are no commits since the latest tag.npm install -g npm@latestis there because trusted publishing landed in npm 11.5.1 and.nvmrc(node 20) ships npm 10.One-time browser step before the first run
This cannot work until the package knows which workflow to trust — on npmjs.com, package Settings → Trusted publisher → GitHub Actions:
arekkubaczkowskireact-native-bottom-sheet-stackrelease.ymlThe workflow file has to be on
mainfor npm to accept it, so: merge this, configure the trusted publisher, then Actions → Release → Run workflow. Tick dry_run on the first go — it prints the version and changelog and touches nothing.Notes
mainis unprotected, so the release commit pushes cleanly. If that ever changes, the push needs an exemption forgithub-actions[bot].GITHUB_TOKENdon't trigger other workflows, so the release commit won't re-run CI. The workflow runsyarn lint,yarn typecheckandyarn testitself before releasing.testjob inci.ymlonly runs the setup action — it never invokesyarn test. Worth a follow-up.🤖 Generated with Claude Code