Automated npm releases via CI (trusted publishing) - #455
Open
malteish wants to merge 1 commit into
Open
Conversation
Pushing a v* tag now publishes to npm and creates the GitHub release automatically: - authenticates via npm trusted publishing (OIDC) — no tokens in the repo, no 2FA one-time passwords, publishes carry --provenance - guards that the tag matches package.json version - runs forge tests and the full build from a fresh checkout, which packs exactly what is committed (no working-directory pollution) - versions with -alpha/-beta suffixes publish under the alpha/beta dist-tag and are marked prerelease on GitHub; other prerelease suffixes go to next; only stable versions become latest - GitHub release notes are extracted from the matching CHANGELOG.md section, falling back to generated notes prepack is reduced to npmignore only, since CI runs tests and build as explicit steps. docs/npm_publishing.md describes the new two-command release flow and the manual fallback. Requires one-time setup on npmjs.com: register this repo's release.yml as trusted publisher for @tokenize.it/contracts.
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.
Stacked on #454 (needs its Node 24 bump — trusted publishing requires npm ≥ 11.5, which ships with Node 24).
Implements the CI release flow: pushing a
v*tag publishes@tokenize.it/contractsto npm and creates the GitHub release. A release becomes:How it works
--provenanceattestations linking the tarball to the exact commit and workflow run.package.json; tests and the full build run against a fresh checkout of the tag, so the tarball contains exactly what's committed — untracked working-directory files can never end up on npm again.-alpha*/-beta*versions publish under thealpha/betadist-tag, other prerelease suffixes undernext, and are marked prerelease on GitHub. Only stable versions getlatest, sonpm installnever resolves to a preview.## [x.y.z]section of CHANGELOG.md (fallback: GitHub's generated notes).prepackis reduced tonpmignore --auto; CI runs tests/build as explicit steps.docs/npm_publishing.mdis rewritten accordingly, including the manual-fallback procedure.One-time setup before merging (npm account required)
On npmjs.com →
@tokenize.it/contracts→ Settings → Trusted Publisher: orgcorpus-io, repotokenize.it-smart-contracts, workflowrelease.yml(no environment). Optionally restrict the package's publishing access to trusted publisher only, which revokes the ability of any token or laptop to publish.🤖 Generated with Claude Code
https://claude.ai/code/session_01BmhG9gFVHiF1XL2AfdAHRr