|
| 1 | +# Releasing |
| 2 | + |
| 3 | +This repository now uses [Changesets](https://github.com/changesets/changesets) for versioning, changelog generation, and npm publishing. |
| 4 | + |
| 5 | +## One-time setup |
| 6 | + |
| 7 | +The GitHub release workflow expects an `NPM_TOKEN` repository secret with publish access to the `react-tutorial-overlay` npm package. |
| 8 | + |
| 9 | +## Everyday workflow |
| 10 | + |
| 11 | +1. Make your code change on a feature branch. |
| 12 | +2. Add a changeset before opening or updating the PR. |
| 13 | +3. Merge the PR into `main`. |
| 14 | +4. Let the Release workflow open or update the version PR. |
| 15 | +5. Merge the version PR to publish the new npm version and update `CHANGELOG.md`. |
| 16 | + |
| 17 | +## Adding a changeset |
| 18 | + |
| 19 | +Run: |
| 20 | + |
| 21 | +```bash |
| 22 | +pnpm changeset |
| 23 | +``` |
| 24 | + |
| 25 | +When prompted: |
| 26 | + |
| 27 | +- Select `react-tutorial-overlay` |
| 28 | +- Pick the appropriate bump type (`patch`, `minor`, or `major`) |
| 29 | +- Write a short, user-facing summary |
| 30 | + |
| 31 | +This creates a markdown file in `.changeset/`. Commit that file with the feature change. |
| 32 | + |
| 33 | +## Useful commands |
| 34 | + |
| 35 | +Create a changeset: |
| 36 | + |
| 37 | +```bash |
| 38 | +pnpm changeset |
| 39 | +``` |
| 40 | + |
| 41 | +Preview versioning locally: |
| 42 | + |
| 43 | +```bash |
| 44 | +pnpm version-packages |
| 45 | +``` |
| 46 | + |
| 47 | +Run the full release verification locally: |
| 48 | + |
| 49 | +```bash |
| 50 | +pnpm release:verify |
| 51 | +``` |
| 52 | + |
| 53 | +Publish locally if you really need to: |
| 54 | + |
| 55 | +```bash |
| 56 | +pnpm release |
| 57 | +``` |
| 58 | + |
| 59 | +The normal path should be the GitHub Release workflow instead of local publishing. |
| 60 | + |
| 61 | +## What the release workflow does |
| 62 | + |
| 63 | +On pushes to `main` or manual dispatch, `.github/workflows/release.yml` runs `changesets/action`. |
| 64 | + |
| 65 | +- If unreleased changesets exist, it opens or updates a release PR. |
| 66 | +- If the release PR has already been merged and version files are on `main`, it runs `pnpm release`. |
| 67 | +- `pnpm release` verifies tests, docs lint/build, size limits, and then runs `changeset publish`. |
| 68 | + |
| 69 | +## Notes for this repo |
| 70 | + |
| 71 | +- Only the root `react-tutorial-overlay` package is versioned and published. |
| 72 | +- `packages/document` and `packages/main` are ignored by Changesets. |
| 73 | +- `CHANGELOG.md` is updated by `changeset version` through the release PR flow. |
0 commit comments