Skip to content

Prep for first npm publish (v0.3.0) - #2

Merged
chalin merged 4 commits into
mainfrom
npm-publish-prep-2026-0722
Jul 22, 2026
Merged

Prep for first npm publish (v0.3.0)#2
chalin merged 4 commits into
mainfrom
npm-publish-prep-2026-0722

Conversation

@chalin

@chalin chalin commented Jul 22, 2026

Copy link
Copy Markdown
Owner
  • Adds a publish workflow: publishes to the npm registry when a GitHub release is published, authenticating via npm trusted publishing (OIDC, automatic provenance); guards that the release tag matches the package version before publishing. The publish job runs no registry-delivered code (no install, no checks — the check workflow already validates every push to main), so nothing untrusted executes with id-token authority.
  • Bumps the version to 0.3.0 for the first registry release (continues the v0.2.x git-tag series; npm pack --dry-run verified: 5 files, 11 kB — LICENSE, README, package.json, the two bins).
  • README: makes registry install primary; keeps the GitHub install as an alternative, now semver-pinned.
  • Owner setup before releasing v0.3.0:
    • Configure the trusted publisher on npmjs.com (package Settings → Trusted Publisher → GitHub Actions: repo chalin/link-cache, workflow publish.yaml).
    • If npm won't accept a trusted-publisher config for a not-yet-published package: publish v0.3.0 once locally (npm publish from the tagged commit, with 2FA), then configure the trusted publisher so later releases go through the workflow with provenance.
    • After first publish: package Settings → Publishing access → "Require two-factor authentication and disallow tokens".
    • Note on triggers: draft releases don't trigger the workflow, but publishing a pre-release does (it's still a published event) — tag versions carefully.

chalin added 4 commits July 22, 2026 08:40
- Adds a publish workflow: publishes to the npm registry when a GitHub release is published, authenticating via npm trusted publishing (OIDC, automatic provenance); guards that the release tag matches the package version.
- Bumps the version to 0.3.0 for the first registry release.
- README: makes registry install primary; keeps the GitHub install as an alternative, now semver-pinned.
- Pins actions to commit SHAs — the job holds npm-publish capability (id-token: write), so mutable tags are an unnecessary risk.
- Installs with --ignore-scripts so dependency install hooks can't execute in the publish job.
- Moves the tag/version guard before the install so nothing runs for a mismatched release tag.
Per review: with no lockfile, `npm run check` resolves devDependencies
fresh at release time and executes them in the job that holds
`id-token: write`. Drop install and checks from the publish job — the
`check` workflow already validates every push to main, and publishing
needs no node_modules (zero runtime deps, no build, no lifecycle
scripts). Also drop the now-unused setup-node cache config and add
`--ignore-scripts` to `npm publish` as defense in depth.
@chalin
chalin merged commit 1d02109 into main Jul 22, 2026
1 check passed
@chalin
chalin deleted the npm-publish-prep-2026-0722 branch July 22, 2026 13:53
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