Skip to content

Commit dd12bc9

Browse files
authored
chore: setup changeset for release (#1014)
* chore: setup changeset for release * use v16 node for now
1 parent c595d2e commit dd12bc9

File tree

10 files changed

+1116
-84
lines changed

10 files changed

+1116
-84
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "graphprotocol/graph-cli" }
6+
],
7+
"commit": false,
8+
"fixed": [],
9+
"linked": [],
10+
"access": "public",
11+
"baseBranch": "main",
12+
"updateInternalDependencies": "patch",
13+
"ignore": [
14+
"basic-event-handlers",
15+
"example-*"
16+
],
17+
"snapshot": {
18+
"useCalculatedVersion": true,
19+
"prereleaseTemplate": "{tag}-{datetime}-{commit}"
20+
}
21+
}

.github/workflows/pr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Snapshot Release
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
dependencies:
9+
uses: the-guild-org/shared-config/.github/workflows/changesets-dependencies.yaml@main
10+
secrets:
11+
githubToken: ${{ secrets.GITHUB_TOKEN }}
12+
13+
release:
14+
uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@main
15+
with:
16+
npmTag: alpha
17+
buildScript: build
18+
nodeVersion: 16
19+
secrets:
20+
githubToken: ${{ secrets.GITHUB_TOKEN }}
21+
npmToken: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Release
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
stable:
9+
uses: the-guild-org/shared-config/.github/workflows/release-stable.yml@main
10+
with:
11+
releaseScript: release
12+
nodeVersion: 16
13+
secrets:
14+
githubToken: ${{ secrets.GITHUB_TOKEN }}
15+
npmToken: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 12 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -56,86 +56,31 @@ If you are ready to dive into the details of building a subgraph from scratch, t
5656

5757
## Release process
5858

59-
The steps to create a new version of the `graph-cli` are:
59+
We use `changeset` to manage releases. Every PR should include a changeset file. The release process is as follows:
6060

61-
1. Decide which version number you'll be rolling out. You can check the differences between the current `main` branch and the latest release.
62-
2. Create a PR with the commit generated by `npm version <VERSION> [<PREID>]`.
63-
3. Once that's approved and merged to `main`, you can publish it to `npm` and push the git tags as well.
64-
4. Last but not least, create a Github Release refering to the pushed git tag, linking to the PRs involved.
61+
1. Author creates the PR with changes and runs `pnpm changeset` to create a changeset file to summarize the changes.
62+
2. When the PR is merged to `main`, a Github Action will run and create a PR with the version bump and changelog.
63+
3. We will merge the bot generated PR to `main`.
64+
4. A Github Action will run and publish the new version to npm.
6565

6666
Helpful links:
6767

6868
- [Semver official docs](https://semver.org/)
69-
- [`npm version` docs](https://docs.npmjs.com/cli/v7/commands/npm-version)
70-
- [`npm publish` docs](https://docs.npmjs.com/cli/v7/commands/npm-publish)
71-
- [`npm unpublish` docs](https://docs.npmjs.com/cli/v7/commands/npm-unpublish)
72-
- [`npm deprecate` docs](https://docs.npmjs.com/cli/v7/commands/npm-deprecate)
69+
- [Changesets](https://github.com/changesets/changesets)
70+
- [Snapshot release](https://github.com/changesets/changesets/blob/main/docs/snapshot-releases.md)
7371

74-
### Stable release example
75-
76-
Current version: `0.34.9`.
77-
Desired release: `0.35.0`.
78-
79-
To create the PR:
80-
```
81-
git checkout -b <BRANCH>
8272

83-
npm version minor
84-
85-
git push --set-upstream <REMOTE> <BRANCH>
86-
```
87-
88-
Once that's approved and merged, you can update your local `main` and:
73+
### Stable release example
8974

90-
```
91-
npm publish
75+
When PRs are merged and to `main` we can choose to merge the bot generated changeset PR to `main` and it will publish a new version to npm.
9276

93-
npm push --tags
94-
```
77+
Example of a `graph-client` release: https://github.com/graphprotocol/graph-client/pull/295
9578

9679
### Alpha release example
9780

98-
Current version: `0.29.2`.
99-
Desired release: `0.30.0-alpha.0`.
100-
101-
To create the PR:
102-
```
103-
git checkout -b <BRANCH>
104-
105-
npm version preminor --preid alpha
106-
107-
git push --set-upstream <REMOTE> <BRANCH>
108-
```
109-
110-
Once that's approved and merged, you can update your local `main` and:
81+
Every PR to `main` that includes a changeset file will create a new alpha version.
11182

112-
```
113-
npm publish --tag alpha
114-
115-
npm push --tags
116-
```
117-
118-
### Alpha pre-release example
119-
120-
Current version: `0.30.0-alpha.0`.
121-
Desired release: `0.30.0-alpha.1`.
122-
123-
To create the PR:
124-
```
125-
git checkout -b <BRANCH>
126-
127-
npm version prerelease --preid alpha
128-
129-
git push --set-upstream <REMOTE> <BRANCH>
130-
```
131-
132-
Once that's approved and merged, you can update your local `main` and:
133-
134-
```
135-
npm publish --tag alpha
136-
137-
npm push --tags
138-
```
83+
Example of `graph-client` snapshot release: https://github.com/graphprotocol/graph-client/pull/178#issuecomment-1214822036
13984

14085
## License
14186

examples/basic-event-handlers/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "basic-event-handlers",
3+
"private": true,
34
"version": "0.1.0",
45
"scripts": {
56
"codegen": "../../packages/cli/bin/graph codegen",

examples/example-subgraph/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "example-event-handler",
3+
"private": true,
34
"scripts": {
45
"codegen": "../../packages/cli/bin/graph codegen --output-dir src/types/ subgraph.yaml",
56
"build": "../../packages/cli/bin/graph build subgraph.yaml",

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"name": "graphprotocol-tools-monorepo",
33
"private": true,
44
"devDependencies": {
5+
"@changesets/changelog-github": "^0.4.7",
6+
"@changesets/cli": "^2.25.2",
57
"eslint": "6.8.0",
68
"jest": "26.0.0"
79
},
@@ -19,6 +21,7 @@
1921
},
2022
"scripts": {
2123
"build": "exit 0",
24+
"release": "changeset publish",
2225
"test:cli": "pnpm --filter @graphprotocol/graph-cli test"
2326
}
2427
}

packages/cli/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@
4545
"test": "jest --verbose",
4646
"test:init": "jest tests/cli/init.test.js --verbose",
4747
"test:validation": "jest tests/cli/validation.test.js --verbose"
48+
},
49+
"publishConfig": {
50+
"access": "public"
4851
}
4952
}

0 commit comments

Comments
 (0)