Skip to content

Commit 4bebe20

Browse files
authored
add a short doc on releasing (#224)
* add doc on releasing * fix punctuation * expand on cleaning * Update release.md * fix git commit * Update release.md * Update release.md
1 parent 92d3b6f commit 4bebe20

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

docs/release.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Releasing
2+
3+
We use [Changesets](https://github.com/changesets/changesets) to version and release our packages.
4+
5+
When you're ready to cut a release, start by versioning the packages:
6+
7+
```
8+
npx changeset version
9+
```
10+
11+
This will consume the changesets in [`.changeset`](../.changeset) and update the [changelog](../CHANGELOG.md) and [`package.json`](../package.json):
12+
13+
```
14+
% git status --short
15+
M CHANGELOG.md
16+
M package.json
17+
```
18+
19+
Based on the versions implications declared by the changesets, the package version will be updated to the next patch, minor, or major:
20+
21+
```diff
22+
"name": "@browserbasehq/stagehand",
23+
- "version": "1.3.0",
24+
+ "version": "1.3.1",
25+
```
26+
27+
Since we updated the `package.json`, we should also update the lockfile ([`package-lock.json`](../package-lock.json)) for tidiness:
28+
29+
```
30+
npm install
31+
```
32+
33+
Now the lockfile should be updated:
34+
35+
```
36+
% git status --short
37+
M CHANGELOG.md
38+
M package-lock.json
39+
M package.json
40+
```
41+
42+
The diff will look something like this:
43+
44+
```diff
45+
{
46+
"name": "@browserbasehq/stagehand",
47+
- "version": "1.3.0",
48+
+ "version": "1.3.1",
49+
"lockfileVersion": 3,
50+
"requires": true,
51+
"packages": {
52+
"": {
53+
"name": "@browserbasehq/stagehand",
54+
- "version": "1.3.0",
55+
+ "version": "1.3.1",
56+
```
57+
58+
At this point we're ready to commit our changes.
59+
It's probably a good idea to have some consistency around the name of this commit message:
60+
61+
```
62+
git commit -am 'Version Packages'
63+
```
64+
65+
Ok, now it's time to publish the release.
66+
Before we do, we have to build the artifacts that comprise the tarball.
67+
Let's clean our working directory first so that we don't accidentally include anything in the tarball that shouldn't be there:
68+
69+
```
70+
% git clean -fxd -e .env
71+
Removing dist/
72+
Removing lib/dom/build/
73+
Removing node_modules/
74+
```
75+
76+
Let's reinstall dependencies and build the artifacts:
77+
78+
```
79+
npm install && npm run build
80+
```
81+
82+
Now we're ready to publish to NPM. You have to be logged in via the `npm` CLI and have to be part of the `@browserbasehq` org:
83+
84+
```
85+
npx changeset publish
86+
```
87+
88+
Congratulations! You just published a new version of `@browserbasehq/stagehand`. 🤘
89+
90+
In the process of publishing, Changesets created an [annotated git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging):
91+
92+
```
93+
🦋 Creating git tag...
94+
🦋 New tag: v1.3.1
95+
```
96+
97+
Let's push the commit and tag to GitHub for posterity:
98+
99+
```
100+
git push --follow-tags
101+
```

0 commit comments

Comments
 (0)