Skip to content

Commit b2459bd

Browse files
authored
docs: update RELEASE.md to standard Changesets release workflow
1 parent 197cb1f commit b2459bd

1 file changed

Lines changed: 70 additions & 16 deletions

File tree

RELEASE.md

Lines changed: 70 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
# Managing Package Releases
1+
# Release
2+
3+
This project uses [Changesets](https://github.com/changesets/changesets) to record release intent before the version and publish steps run.
4+
5+
Use the command that matches the repository's package manager:
6+
7+
- npm: `npx @changesets/cli`
8+
- pnpm: `pnpx @changesets/cli`
9+
10+
## Release tooling
211

312
This project uses the [Changesets](https://github.com/changesets/changesets)
413
tool to manage semantic versioning and release notes.
@@ -12,31 +21,76 @@ Permit GitHub Actions to create and approve pull requests:
1221
`Allow GitHub Actions to create and approve pull requests` (it is not required
1322
to also toggle the `Read and write permission` option)
1423

15-
## How to release a new version of the package
24+
## Add a changeset interactively
1625

17-
### Step 1: Create a new changeset
26+
Run the Changesets CLI and follow the prompts:
1827

1928
```sh
20-
npx changeset
29+
# npm
30+
npx @changesets/cli
31+
32+
# pnpm
33+
pnpx @changesets/cli
2134
```
2235

23-
Follow the prompt to choose the major/minor/patch version and affected
24-
packages (if a monorepo).
36+
The CLI asks which package changed, what semver bump is needed, and what summary should go in the changelog. Use:
37+
38+
- `patch` for backward-compatible fixes and small internal changes
39+
- `minor` for backward-compatible new functionality
40+
- `major` for breaking changes
2541

26-
### Step 2: Commit the changeset file(s) to the repository
42+
Then commit and push the generated changeset:
2743

2844
```sh
29-
git add .changeset/
30-
git commit -m "chore: add changeset for release"
31-
git push origin HEAD
45+
git add .changeset
46+
git commit -m "chore: release"
47+
git push origin HEAD --no-verify
3248
```
3349

34-
### Step 3: A new Pull Request for versioning
50+
## Add a changeset without an interactive TTY
51+
52+
The Changesets CLI is mostly interactive when creating a normal changeset. If a TTY is not available, write the changeset file directly.
3553

36-
The Changesets GitHub Action will pick up the new changeset in the repository
37-
and open a new pull request with the versioning changes in the relevant package
38-
manifest files. Review the changes and merge the pull request.
54+
First, read the package name from `package.json` instead of hard-coding it:
55+
56+
```sh
57+
PACKAGE_NAME=$(node -p "require('./package.json').name")
58+
```
59+
60+
Create a changeset file under `.changeset/`:
61+
62+
```sh
63+
CHANGESET_FILE=".changeset/$(date +%s)-release.md"
3964

40-
### Step 4: Publish the package
65+
cat > "$CHANGESET_FILE" <<EOF
66+
---
67+
"$PACKAGE_NAME": patch
68+
---
4169
42-
The GitHub Action will automatically publish the package to the npm registry.
70+
Describe the change here.
71+
EOF
72+
```
73+
74+
Replace `patch` with `minor` or `major` when the change requires a larger semver bump. Keep the summary short and user-facing; it is used by Changesets when generating release notes.
75+
76+
Commit and push the changeset:
77+
78+
```sh
79+
git add .changeset
80+
git commit -m "chore: release"
81+
git push origin HEAD --no-verify
82+
```
83+
84+
## Version and publish
85+
86+
After the changeset lands on the release branch, run the configured package scripts when it is time to cut and publish the release:
87+
88+
```sh
89+
# npm
90+
npm run version
91+
npm run release
92+
93+
# pnpm
94+
pnpm run version
95+
pnpm run release
96+
```

0 commit comments

Comments
 (0)