You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/using-changesets.md
+30-29
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ title: Using Changesets with pnpm
6
6
:::note
7
7
8
8
At the time of writing this documentation, the latest pnpm version was
9
-
v6.14. The latest [Changesets](https://github.com/changesets/changesets) version was v2.16.0.
9
+
v10.4.1. The latest [Changesets](https://github.com/changesets/changesets) version was v2.28.0.
10
10
11
11
:::
12
12
@@ -19,7 +19,7 @@ in the root of the workspace:
19
19
pnpm add -Dw @changesets/cli
20
20
```
21
21
22
-
Then changesets' init command:
22
+
Then run changesets' init command to generate a changesets config:
23
23
24
24
```sh
25
25
pnpm changeset init
@@ -41,18 +41,13 @@ to the repository.
41
41
4. Run `pnpm publish -r`. This command will publish all packages that have
42
42
bumped versions not yet present in the registry.
43
43
44
-
## Using GitHub Actions
44
+
## Integration with GitHub Actions
45
45
46
-
To automate the process, you can use `changeset version` with GitHub actions.
46
+
To automate the process, you can use `changeset version` with GitHub actions. The action will detect when changeset files arrive in the `main` branch, and then open a new PR listing all the packages with bumped versions. The PR will automatically update itself every time a new changeset file arrives in `main`. Once merged the packages will be updated, and if the `publish` input has been specified on the action they will be published using the given command.
47
47
48
-
### Bump up package versions
48
+
### Add a publish script
49
49
50
-
The action will detect when changeset files arrive in the `main` branch, and then open a new PR listing all the packages with bumped versions. Once merged, the packages will be updated and you can decide whether to publish or not by adding the `publish` property.
51
-
52
-
### Publishing
53
-
54
-
Add a new script `ci:publish` which executes `pnpm publish -r`.
55
-
It will publish to the registry once the PR is opened by `changeset version`.
50
+
Add a new script called `ci:publish` which executes `pnpm publish -r`. This will publish to the registry once the PR created by `changeset version` has been merged. If the package is public and scoped, adding `--access=public` may be necessary to prevent npm rejecting the publish.
56
51
57
52
**package.json**
58
53
```json
@@ -64,46 +59,52 @@ It will publish to the registry once the PR is opened by `changeset version`.
64
59
}
65
60
```
66
61
62
+
### Add the workflow
63
+
64
+
Add a new workflow at `.github/workflows/changesets.yml`. This workflow will create a new branch and PR, so Actions should be given **read and write** permissions in the repo settings (`github.com/<repo-owner>/<repo-name>/settings/actions`). If including the `publish` input on the `changesets/action` step, the repo should also include an auth token for npm as a repository secret named `NPM_TOKEN`.
0 commit comments