Release on npm #48
Send to my agentClosed
tombeckenham opened this issue ·0 comments
Goal#
Ship the release pipeline, not the first public versions. No npm publish / npm stage publish against the live registry as part of this issue.
Packages (keep names; all currently 404 on npm):
@modelschemas/client0.1.0@modelschemas/codegen0.1.0@modelschemas/vite0.1.0modelschemas(unscoped CLI)0.1.0
Create / own the @modelschemas npm org. CLI stays unscoped.
Security posture (maximum)#
- No long-lived npm token in GitHub. GitHub Actions authenticates to npm with OIDC trusted publishers.
- Stage-only trusted publisher permissions. CI may run
npm stage publishonly — notnpm publish. A maintainer 2FA-approves each staged version on npmjs.com (ornpm stage approve) before it is installable. - After the one-time bootstrap, each package: Settings → Publishing access → Require two-factor authentication and disallow tokens.
- Provenance attestations are automatic on trusted-publisher GitHub Actions publishes (no
--provenanceflag). - Publish job uses GitHub Environment
npm(required reviewer + deployment-branch/tag limits). Workflow file is.github/workflows/publish.yml— npm trusted-publisher config must use that filename exactly. bun publishis not used for the CI publish step: Bun still talks token auth (NPM_CONFIG_TOKEN); OIDC +npm stagerequire npm CLI ≥ 11.15.0. Bun is used only to pack (it rewritesworkspace:*).
Triggers#
- Push of a
v*version tag (covers GitHub Releases that create that tag) workflow_dispatchwithdry_rundefaulting to true (pack + verify, do not stage)
Not on every push to main. Package versions come from each package.json, not from the tag name; a tag v0.1.0 must match those versions or the job fails.
First-publish bootstrap (human, one-time)#
npm's npm trust and npm stage publish both require the package to already exist. First 0.1.0 of each package cannot be staged.
- Create the
@modelschemasorg; enable 2FA on the publishing account. - From a trusted laptop (
npm login, 2FA): pack withbun scripts/npm-stage.ts --pack-dir <dir> --dry-run, thennpm publish <tarball> --access publicin order: client → codegen → vite → CLI. Approve each 2FA prompt. - For each package:
npm trust github <name> --file publish.yml --repo modelschemas/modelschemas --env npm --allow-stage-publish - Disallow tokens on each package (step 3 in Security).
- GitHub repo Settings → Environments →
npm: required reviewer; limit deploys tomain/v*tags.
Ongoing releases: tag vX.Y.Z → Actions stages tarballs → 2FA-approve on npmjs.com Staged Packages (same order).
Out of scope#
- Actually publishing
0.1.0to the registry - Changesets / auto version bumps
- Renaming the npm scope
tombeckenham closed this
Sign in to join this conversation.