|
| 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 | +- When a release tag is created, CI publishes to npm automatically |
| 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 | +3. Allow Release Please to open PRs |
| 24 | + - GitHub: Settings > Actions > General |
| 25 | + - Set Workflow permissions to "Read and write" |
| 26 | + - Enable "Allow GitHub Actions to create and approve pull requests" |
| 27 | + |
| 28 | +## Normal release flow |
| 29 | + |
| 30 | +1. Merge changes into `master` via PRs. |
| 31 | + - Recommended: use **Squash and merge** so the PR title becomes the commit message. |
| 32 | + - Release automation relies on Conventional-Commits style messages like `feat: ...` / `fix: ...`. |
| 33 | + |
| 34 | +2. Wait for the bot PR named like `release-please--branches--master`. |
| 35 | + - It bumps `package.json` and updates `CHANGELOG.md` |
| 36 | + - If it already exists, it gets updated automatically as new PRs merge |
| 37 | + |
| 38 | +3. When you're ready to ship, merge the Release PR. |
| 39 | + - This creates a git tag `vX.Y.Z` and a GitHub Release |
| 40 | + - The `Release Please` workflow publishes to npm as part of the same run |
| 41 | + |
| 42 | +## Notes |
| 43 | + |
| 44 | +- If a version is already published on npm, CI skips the publish step (useful when seeding historical tags). |
0 commit comments