Skip to content

Commit 4630dbd

Browse files
authored
Changesets fixes and update to latest setup (#180)
1 parent f9b88c3 commit 4630dbd

File tree

11 files changed

+55
-487
lines changed

11 files changed

+55
-487
lines changed

.changeset/config.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@1.7.0/schema.json",
3-
"changelog": "@changesets/cli/changelog",
2+
"$schema": "https://unpkg.com/@changesets/config@2.1.0/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "graphprotocol/graph-client" }],
44
"commit": false,
55
"linked": [],
66
"ignore": [
@@ -18,5 +18,10 @@
1818
"cross-chain-extension"
1919
],
2020
"access": "public",
21-
"baseBranch": "main"
21+
"baseBranch": "main",
22+
"updateInternalDependencies": "patch",
23+
"snapshot": {
24+
"useCalculatedVersion": true,
25+
"prereleaseTemplate": "{tag}-{datetime}-{commit}"
26+
}
2227
}

.changeset/khaki-nails-film.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/client-cli': patch
3+
---
4+
5+
temp

.github/workflows/canary.yml

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
name: Canary Release
1+
name: release
22

33
on:
44
pull_request:
55
paths:
66
- '.changeset/**/*.md'
77

88
jobs:
9-
publish-canary:
10-
name: Publish Canary
9+
canary:
1110
runs-on: ubuntu-latest
1211
if: github.event.pull_request.head.repo.full_name == github.repository
1312
steps:
1413
- name: Checkout
1514
uses: actions/checkout@v3
1615
with:
1716
fetch-depth: 0
17+
1818
- name: Use Node
1919
uses: actions/setup-node@v3
2020
with:
@@ -24,44 +24,12 @@ jobs:
2424
- name: Install Dependencies using Yarn
2525
run: yarn
2626

27-
- name: Setup NPM credentials
28-
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
29-
env:
30-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
31-
3227
- name: Release Canary
3328
id: canary
34-
uses: 'kamilkisiela/release-canary@master'
29+
uses: 'the-guild-org/changesets-snapshot-action@main'
30+
with:
31+
tag: alpha
32+
prepareScript: 'yarn build'
3533
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3734
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
38-
with:
39-
npm-token: ${{ secrets.NPM_TOKEN }}
40-
npm-script: 'yarn release:canary'
41-
changesets: true
42-
43-
- name: Publish a message
44-
if: steps.canary.outputs.released == 'true'
45-
uses: 'kamilkisiela/pr-comment@master'
46-
with:
47-
commentKey: canary
48-
message: |
49-
The latest changes of this PR are available as canary in npm (based on the declared `changesets`):
50-
51-
```
52-
${{ steps.canary.outputs.changesetsPublishedPackages}}
53-
```
54-
bot-token: ${{ secrets.GITHUB_TOKEN }}
55-
bot: 'github-actions[bot]'
56-
github-token: ${{ secrets.GITHUB_TOKEN }}
57-
58-
- name: Publish a empty message
59-
if: steps.canary.outputs.released == 'false'
60-
uses: 'kamilkisiela/pr-comment@master'
61-
with:
62-
commentKey: canary
63-
message: |
64-
The latest changes of this PR are not available as canary, since there are no linked `changesets` for this PR.
65-
bot-token: ${{ secrets.GITHUB_TOKEN }}
66-
bot: 'github-actions[bot]'
67-
github-token: ${{ secrets.GITHUB_TOKEN }}
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: dependencies
2+
on: pull_request
3+
jobs:
4+
changeset:
5+
if: github.event.pull_request.head.repo.full_name == github.repository
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v3
10+
with:
11+
fetch-depth: 0
12+
13+
- name: Create/Update Changesets
14+
uses: 'the-guild-org/changesets-dependencies-action@main'
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: release
22

33
on:
44
push:
@@ -7,39 +7,42 @@ on:
77

88
jobs:
99
release:
10-
name: Release
10+
name: stable
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout Repo
14-
uses: actions/checkout@master
13+
- name: Checkout
14+
uses: actions/checkout@v3
1515
with:
16-
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1716
fetch-depth: 0
1817

1918
- name: Use Node
20-
uses: actions/setup-node@master
19+
uses: actions/setup-node@v3
2120
with:
22-
node-version: 16.x
21+
node-version: 18
2322
cache: 'yarn'
2423

25-
- name: Setup NPM credentials
26-
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
27-
env:
28-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29-
3024
- name: Install Dependencies using Yarn
3125
run: yarn
3226

3327
- name: Build Packages
3428
run: yarn build
3529

30+
- name: set version variables
31+
id: vars
32+
shell: bash
33+
run: |
34+
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
35+
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
36+
3637
- name: Create Release Pull Request or Publish to npm
3738
id: changesets
3839
uses: changesets/action@master
3940
with:
4041
publish: yarn release
4142
commit: 'chore(release): update monorepo packages versions'
4243
title: 'Upcoming Release Changes'
44+
createGithubReleases: aggregate
45+
githubReleaseName: 'Release ${{ steps.vars.outputs.sha_short }} (from ${{ steps.vars.outputs.branch }})'
4346
env:
4447
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4548
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
"name": "thegraph-client-monorepo",
33
"private": true,
44
"scripts": {
5-
"postinstall": "patch-package && husky install",
5+
"postinstall": "husky install",
66
"format": "prettier . --write",
77
"pretty-quick": "pretty-quick --staged",
88
"prebuild": "rimraf packages/*/dist",
99
"check": "yarn workspaces run check",
1010
"build": "bob build",
1111
"test": "jest --passWithNoTests --detectLeaks --detectOpenHandles",
1212
"release": "yarn build && changeset publish",
13-
"release:canary": "(node scripts/canary-release.js && yarn build && yarn changeset publish --tag canary) || echo Skipping Canary...",
1413
"fix-bin": "node scripts/fix-bin.js",
1514
"postbuild": "yarn fix-bin"
1615
},
@@ -44,7 +43,7 @@
4443
"@babel/plugin-proposal-decorators": "7.18.10",
4544
"@babel/preset-env": "7.18.10",
4645
"@babel/preset-typescript": "7.18.6",
47-
"@changesets/cli": "2.21.1",
46+
"@changesets/cli": "2.24.2",
4847
"@types/babel__core": "7.1.19",
4948
"@types/babel__preset-env": "7.9.2",
5049
"@types/jest": "28.1.6",
@@ -55,7 +54,6 @@
5554
"graphql": "16.5.0",
5655
"husky": "8.0.1",
5756
"jest": "28.1.3",
58-
"patch-package": "6.4.7",
5957
"prettier": "2.7.1",
6058
"pretty-quick": "3.1.3",
6159
"rimraf": "3.0.2",
@@ -64,7 +62,6 @@
6462
"ts-jest": "28.0.7"
6563
},
6664
"resolutions": {
67-
"@changesets/apply-release-plan": "6.0.0",
6865
"graphql": "16.5.0"
6966
}
7067
}

0 commit comments

Comments
 (0)