Skip to content

Commit efb77e6

Browse files
authored
Use changesets for releases, use Node 20 (#1154)
1 parent e778369 commit efb77e6

File tree

15 files changed

+606
-43
lines changed

15 files changed

+606
-43
lines changed

.changeset/config.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{
6+
"repo": "OpenZeppelin/openzeppelin-upgrades"
7+
}
8+
],
9+
"commit": false,
10+
"fixed": [],
11+
"linked": [],
12+
"access": "public",
13+
"baseBranch": "master",
14+
"updateInternalDependencies": "patch",
15+
"ignore": []
16+
}

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
node-version: 18.x
8+
node-version: 20.x
99
cache: yarn
1010

1111
- name: Install dependencies

.github/workflows/changeset.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Changeset
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
types:
8+
- opened
9+
- synchronize
10+
- labeled
11+
- unlabeled
12+
13+
concurrency:
14+
group: changeset-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
check:
19+
runs-on: ubuntu-latest
20+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ignore-changeset') }}
21+
steps:
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
23+
with:
24+
fetch-depth: 0 # Include history so Changesets finds merge-base
25+
- name: Set up environment
26+
uses: ./.github/actions/setup
27+
- name: Check changeset
28+
run: npx changeset status --since=origin/${{ github.base_ref }}

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish Packages
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency: version-or-publish-${{ github.ref }}
7+
8+
jobs:
9+
publish:
10+
name: Publish Packages
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
runs-on: ubuntu-latest
15+
environment: publish
16+
steps:
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
18+
with:
19+
fetch-depth: 0 # To get all tags
20+
ref: ${{ github.ref }}
21+
- name: Set up environment
22+
uses: ./.github/actions/setup
23+
- name: Create Prepare Release PR or Publish
24+
id: changesets
25+
uses: changesets/action@001cd79f0a536e733315164543a727bdf2d70aff # v1.5.1
26+
with:
27+
title: Prepare Release
28+
commit: Prepare Release
29+
version: npm run version
30+
publish: npm run publish
31+
commitMode: github-api
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
- name: Check changesets status
36+
if: steps.changesets.outputs.hasChangesets == 'true'
37+
run: |
38+
echo "Changesets found. Merge Prepare Release PR before publishing."
39+
exit 1
40+
- name: Check publish status
41+
if: steps.changesets.outputs.published == 'false'
42+
run: |
43+
echo "Publish failed. Check the logs for more details."
44+
exit 1

.github/workflows/version.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Version Packages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- 'docs/**'
9+
10+
concurrency: version-or-publish-${{ github.ref }}
11+
12+
jobs:
13+
version:
14+
name: Prepare Release PR
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
21+
with:
22+
fetch-depth: 0 # To get all tags
23+
ref: ${{ github.ref }}
24+
- name: Set up environment
25+
uses: ./.github/actions/setup
26+
- name: Create Prepare Release PR
27+
uses: changesets/action@001cd79f0a536e733315164543a727bdf2d70aff # v1.5.1
28+
with:
29+
title: Prepare Release
30+
commit: Prepare Release
31+
version: npm run version
32+
commitMode: github-api
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
20

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ If linting errors or warnings occur, run `yarn lint --fix` to attempt to auto-fi
3131

3232
As a contributor, we ask that you fork this repository, work on your own fork and then submit pull requests. The pull requests will be reviewed and eventually merged into the main repo. See ["Fork-a-Repo"](https://help.github.com/articles/fork-a-repo/) for how this works.
3333

34+
### Adding Changesets
35+
If your PR modifies code under `packages`, you will need to add a changeset to summarize the changes. The PR's `Changeset` GitHub check will give an error if this condition is not satisfied.
36+
- To add a changeset: from the root directory, run `yarn changeset`

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"lint": "yarn lint:path .",
1111
"lint:path": "eslint --ignore-path .gitignore --max-warnings 0",
1212
"test": "wsrun -ms test",
13-
"coverage": "nyc yarn test"
13+
"coverage": "nyc yarn test",
14+
"version": "bash scripts/release/version.sh",
15+
"publish": "bash scripts/release/publish.sh"
1416
},
1517
"devDependencies": {
1618
"@openzeppelin/docs-utils": "^0.1.0",
@@ -24,7 +26,9 @@
2426
"nyc": "^17.0.0",
2527
"prettier": "^3.0.0",
2628
"typescript": "^5.0.0",
27-
"wsrun": "^5.2.4"
29+
"wsrun": "^5.2.4",
30+
"@changesets/cli": "^2.29.3",
31+
"@changesets/changelog-github": "^0.5.1"
2832
},
2933
"workspaces": {
3034
"packages": [

packages/core/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@openzeppelin/upgrades-core",
33
"version": "1.44.0",
44
"description": "",
5-
"repository": "https://github.com/OpenZeppelin/openzeppelin-upgrades/tree/master/packages/core",
5+
"repository": "https://github.com/OpenZeppelin/openzeppelin-upgrades",
66
"license": "MIT",
77
"main": "dist/index.js",
88
"files": [
@@ -38,7 +38,6 @@
3838
"test": "ava",
3939
"test:update-snapshots": "yarn test --update-snapshots",
4040
"test:watch": "hardhat compile --force && yarn copyfiles && fgbg 'ava --watch' 'tsc -b --watch' --",
41-
"version": "node ../../scripts/bump-changelog.js",
4241
"cli": "node ./dist/cli/cli.js"
4342
},
4443
"bin": {
@@ -52,7 +51,7 @@
5251
"@types/debug": "^4.1.5",
5352
"@types/minimist": "^1.2.5",
5453
"@types/mocha": "^7.0.2",
55-
"@types/node": "^16.11.7",
54+
"@types/node": "^20.0.0",
5655
"@types/proper-lockfile": "^4.1.1",
5756
"@types/sinon": "^17.0.0",
5857
"ava": "^6.0.0",

packages/plugin-hardhat/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@openzeppelin/hardhat-upgrades",
33
"version": "3.9.0",
44
"description": "",
5-
"repository": "https://github.com/OpenZeppelin/openzeppelin-upgrades/tree/master/packages/plugin-hardhat",
5+
"repository": "https://github.com/OpenZeppelin/openzeppelin-upgrades",
66
"license": "MIT",
77
"main": "dist/index.js",
88
"files": [
@@ -15,10 +15,9 @@
1515
"scripts": {
1616
"clean": "rimraf dist *.tsbuildinfo",
1717
"compile": "tsc -b",
18-
"prepare": "yarn clean && yarn compile",
18+
"prepare": "yarn compile",
1919
"test": "tsc -b && bash scripts/test.sh",
20-
"test:watch": "fgbg 'bash scripts/test.sh --watch' 'tsc -b --watch' --",
21-
"version": "node ../../scripts/bump-changelog.js"
20+
"test:watch": "fgbg 'bash scripts/test.sh --watch' 'tsc -b --watch' --"
2221
},
2322
"devDependencies": {
2423
"@nomicfoundation/hardhat-ethers": "^3.0.5",

0 commit comments

Comments
 (0)