Releasing
Packages are versioned with Changesets and published to npm under @assuncaocharles:
| Package | npm |
|---|---|
| Widget | @assuncaocharles/pinback |
| Core | @assuncaocharles/pinback-core |
| Vite source plugin | @assuncaocharles/pinback-source-plugin |
Day to day
- In a PR that changes a published package, run
pnpm changeset, pick the bump, and describe the change. - When it merges, the Release workflow opens or updates a Version Packages PR with the version bumps and changelogs.
- Merging that PR publishes the new versions, with provenance, and tags them.
pnpm release:dry-run packs everything and runs npm publish --dry-run locally.
One-time setup
- Repository variable
NPM_PUBLISH=trueturns publishing on. Without it, the workflow only maintains the Version Packages PR. - Settings → Actions → General → "Allow GitHub Actions to create and approve pull requests" must be on for the Version Packages PR.
Trusted publishing (no token)
The workflow publishes with npm trusted publishing (OIDC), so no npm token is stored in GitHub. npm only offers trusted-publisher settings for packages that already exist, so the first release is bootstrapped once with staged publishing. Staging needs no 2FA, so an ordinary granular token works; a 2FA-bypass token is not needed (npm is retiring their publish rights, around January 2027).
- Create a granular npm token with read and write access to packages, with a short expiry (e.g. 1 day). Save it as the repository secret
NPM_TOKEN. - Set the repository variable
NPM_STAGE=true, then merge the Version Packages PR (or re-run the latest Release run). Each package is staged; npm creates a0.0.0-stageplaceholder for new packages. - On npmjs.com, open Staged Packages and approve the three versions (one 2FA challenge for a batch). They are now live.
- Open each package → Settings → Trusted publisher → GitHub Actions: repository
assuncaocharles/pinback, workflowrelease.yml. Under allowed actions, also allownpm publishif releases should go live without approval. - Delete the token on npm and remove the
NPM_TOKENsecret. If you allowed direct publishing, removeNPM_STAGEtoo; otherwise keep it and approve each release on npmjs.com.
How publishing works
scripts/publish.mjs:
- packs each public package with
pnpm pack, which rewritesworkspace:*; - publishes the tarball with
npm publish --provenance --access public(npm stage publishwhenNPM_STAGEis set); - skips versions already on npm, so re-runs are safe;
- then creates git tags (
changeset tag), which the workflow pushes and turns into GitHub releases.