|
| 1 | +# Releasing |
| 2 | + |
| 3 | +This repo publishes an npm package: `codebase-context`. |
| 4 | + |
| 5 | +We use a clean OSS-style flow: |
| 6 | + |
| 7 | +- PRs merge into `master` (nothing publishes on merge) |
| 8 | +- A release is created by a dedicated **Release PR** opened/updated automatically |
| 9 | +- When the Release PR is merged, CI creates a git tag like `v1.2.3` |
| 10 | +- Tag pushes trigger CI to publish to npm |
| 11 | + |
| 12 | +## One-time setup (maintainers) |
| 13 | + |
| 14 | +1. Add a repository secret: `NPM_TOKEN` |
| 15 | + - Create an npm access token with publish rights for `codebase-context` |
| 16 | + - Add it in GitHub: Settings > Secrets and variables > Actions > New repository secret |
| 17 | + - If your npm tokens expire (for example after 90 days), rotate the token and update this secret before it expires |
| 18 | + |
| 19 | +2. (Recommended) Protect `master` |
| 20 | + - Require PRs (no direct pushes) |
| 21 | + - Require the `Tests` workflow to pass |
| 22 | + |
| 23 | +This repo also uses `CODEOWNERS` so PRs from non-owners require an approval from `@PatrickSys`. |
| 24 | + |
| 25 | +## Normal release flow |
| 26 | + |
| 27 | +1. Merge changes into `master` via PRs. |
| 28 | + - Recommended: use **Squash and merge** so the PR title becomes the commit message. |
| 29 | + - Release automation relies on Conventional-Commits style messages like `feat: ...` / `fix: ...`. |
| 30 | + |
| 31 | +2. Wait for the bot PR named like `release-please--branches--master`. |
| 32 | + - It bumps `package.json` and updates `CHANGELOG.md` |
| 33 | + - If it already exists, it gets updated automatically as new PRs merge |
| 34 | + |
| 35 | +3. When you're ready to ship, merge the Release PR. |
| 36 | + - This creates a git tag `vX.Y.Z` and a GitHub Release |
| 37 | + - The `Publish` workflow runs on the tag and publishes to npm |
| 38 | + |
| 39 | +## Notes |
| 40 | + |
| 41 | +- Publishing is triggered only by `v*` tags. |
| 42 | +- The publish workflow verifies `tag == v${package.json.version}` and fails fast if they don't match. |
0 commit comments