Add node engines floor and npm trusted-publishing release workflow - #9
Merged
Conversation
The published bundle targets node, so declare node >=20 alongside the bun engine used for development. The release workflow publishes on v* tags via npm trusted publishing (OIDC, provenance attached), with a guard that the tag matches package.json. The first release still has to be published manually before the trusted publisher can be configured on npmjs.com. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pin actions to commit SHAs so a moved tag cannot inject code, pin bun and npm to exact versions so the publish toolchain is reproducible, declare least-privilege permissions explicitly in both workflows, and gate the publish job behind a release environment so required-reviewer approval and trusted-publisher scoping can be configured in repo settings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Prepares the package for npm distribution: consumers install the node-target bundle, and releases after the first one publish from CI without a long-lived npm token.
Changes
package.jsonnow declaresnode: >=20alongside the existing bun engine. The publisheddist/cli.jstargets node, so the engines field should describe what consumers need, not only what development needs..github/workflows/release.ymlpublishes onv*tags via npm trusted publishing (OIDC). A guard step fails the run if the tag does not match thepackage.jsonversion.npm publishstill triggersprepublishOnly, so the checks and the node-target build run before anything ships. The publish job runs in areleaseenvironment so required-reviewer approval and trusted-publisher scoping can be layered on in repo settings.contents: read, withid-token: writeonly on the publish job).Why
Trusted publishing avoids storing an npm token in repo secrets and attaches a provenance attestation to each release, which matters for a public package operators install globally. The first release must be published manually because npm only lets you configure a trusted publisher on an existing package; the workflow header documents this. SHA-pinning and exact toolchain versions ensure a moved tag or a compromised "latest" cannot alter what gets built or published.
🤖 Generated with Claude Code