New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automate release process via Changesets #3915
Merged
Merged
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
a105bb3
Configure changesets
ernestognw cbbcede
Add missing dates
ernestognw c159669
Solve publishing for release candidates
ernestognw eb128b8
Fix publishing flag
ernestognw 04c64f4
Fix title regex
ernestognw d95a5a0
Moved PR back to main when there's a final release published
ernestognw fbedc50
Add create PR back job
ernestognw 6b4529d
Fix typo in pr_back
ernestognw d37fd80
Fix read changeset state
ernestognw 39872ac
Fix accessing preState
ernestognw d976108
Fix `value === undefined`
ernestognw f1c4226
Fix issues with creating PR back
ernestognw da0b18f
Publish only contracts folder
ernestognw 4f03b6a
Make `format-changelog.js` executable
ernestognw d29f472
Add tags to changeset PR
ernestognw 4535c89
Add changeset version script to version
ernestognw 2ec03e7
Fix mismatches between release-cycle.yml versions
ernestognw b609812
Add extra checks
ernestognw 084f348
Added changelogs
ernestognw 919211a
Rebase master
ernestognw edf9719
Remove environment from changesets job
ernestognw fefdf33
Remove Release Cycle environment from `check_state`
ernestognw da5c20f
Add permissions to publish tag
ernestognw e275830
Remove `GH_TOKEN`
ernestognw 10eeabf
Add permissions
ernestognw 997743d
Split workflow in scripts
ernestognw 53e09df
Remove npx
ernestognw 138ec52
Applied suggestions
ernestognw 16bdf8e
Improved RegExp for `format-changelog.js`
ernestognw 0e7249a
Removed rerun dispatch
ernestognw 465696c
Avoid writing `NPM_TOKEN` to disk
ernestognw f04be5f
Pack and publish in separated steps
ernestognw 8e86049
Use correct npm tags
ernestognw ea07d68
Extract changelog entry for GitHub release
ernestognw cd8b1f2
Fix linter warnings
ernestognw fbbaf1e
Change `github-script` refs
ernestognw 7def70f
Fix `.length` in state
ernestognw aa3d9b0
Prefer local branchs in `set-changesets-pr-title.js`
ernestognw c058a68
Remove origin
ernestognw 700a86f
Fix sorting versions error
ernestognw c519284
Fix typo with `core.exportVariable`
ernestognw faa4b93
Fix state
ernestognw e8dc5d4
Applied review comments
ernestognw d83f0fc
Change `readChangesetState`
ernestognw 5dbddaf
Added " to $() definitions
ernestognw 7054e6d
Fix `start` script
ernestognw ab89a0f
Refactor publish
ernestognw 84b70e7
Recovering `rerun` dispatch (sorry @frangio)
ernestognw e699362
Fix rerun script
ernestognw 85113f0
Fix `start` script
ernestognw e68c1e4
Fix `rerun.js`
ernestognw fe1cb92
Add `actions:write` permissions to `rerun`
ernestognw 5d5dfd3
Allow `rerun` on other branch
ernestognw eb1af48
Fix state
ernestognw 4c5d93e
Add input to identify reruns
ernestognw 1d399ea
Fix run changesets
ernestognw 729da37
Change input to string
ernestognw c439333
Attempt to use boolean input
ernestognw f943dd1
Use `getInput` instead
ernestognw 91f3bb0
Add `debug` to state variables
ernestognw 19af041
Fix order of state
ernestognw b3ff23e
Detect bot dispatches via `triggering_actor`
ernestognw ca30db6
Remove inputs from `rerun.js`
ernestognw b25a01f
Keep publish in root
ernestognw 8c7e481
Get tarball from `npm pack`
ernestognw 9ec5937
Bound function vars
ernestognw 34264c0
Fixes after testing
ernestognw 283b931
Fix synchronize versions
ernestognw e61b43d
Fix version reference during publish
ernestognw 49bffa3
Remove double `npm pack`
ernestognw 33aa4c6
Correctly get tarball name
ernestognw 6c96c3c
Fixes for Github Release
ernestognw 6b97f23
Remove VERSION variable
ernestognw f2e051d
Recover REF in rerun
ernestognw 06b9cc8
Make exit prerelease condition to be in `release-cycle.yml`
ernestognw 36c6a59
Apply review suggestions
ernestognw d4e0025
Add `theirs` strategy to merging master back
ernestognw a763dc1
Remove `rc` sections for final releases
ernestognw 90ec2ea
Update .github/workflows/release-cycle.yml
ernestognw fc79086
Update scripts/release/workflow/prepare-release-merge.sh
ernestognw f500d3e
Update scripts/release/workflow/prepare-release-merge.sh
ernestognw 80d2a52
Update scripts/release/workflow/prepare-release-merge.sh
ernestognw 9832ae6
Fix publishing
ernestognw 679e930
Isolate better the NPM_TOKEN
ernestognw File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`Initializable`: optimize `_disableInitializers` by using `!=` instead of `<`. ([#3787](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3787)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", | ||
"changelog": [ | ||
"@changesets/changelog-github", | ||
{ | ||
"repo": "OpenZeppelin/openzeppelin-contracts" | ||
} | ||
], | ||
"commit": false, | ||
"access": "public", | ||
"baseBranch": "master" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': minor | ||
--- | ||
|
||
`ReentrancyGuard`: Add a `_reentrancyGuardEntered` function to expose the guard status. ([#3714](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3714)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`Ownable2Step`: make `acceptOwnership` public virtual to enable usecases that require overriding it. ([#3960](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3960)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': minor | ||
--- | ||
|
||
`EnumerableMap`: add a `keys()` function that returns an array containing all the keys. ([#3920](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3920)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
Reformatted codebase with latest version of Prettier Solidity. ([#3898](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3898)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': minor | ||
--- | ||
|
||
`Strings`: add `equal` method. ([#3774](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3774)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`Math`: optimize `log256` rounding check. ([#3745](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3745)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`ERC20Votes`: optimize by using unchecked arithmetic. ([#3748](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3748)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`Multicall`: annotate `multicall` function as upgrade safe to not raise a flag for its delegatecall. ([#3961](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3961)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': minor | ||
--- | ||
|
||
`Strings`: add `toString` method for signed integers. ([#3773](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3773)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
`MerkleProof`: optimize by using unchecked arithmetic. ([#3745](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3745)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: changeset | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: | ||
- opened | ||
- synchronize | ||
- labeled | ||
- unlabeled | ||
|
||
concurrency: | ||
group: changeset-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ignore-changeset') }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up environment | ||
uses: ./.github/actions/setup | ||
- name: Check changeset | ||
run: npx changeset status --since=${{ github.base_ref }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,177 @@ | ||||||
name: Release Cycle | ||||||
|
||||||
on: | ||||||
push: | ||||||
branches: | ||||||
- release-v* | ||||||
workflow_dispatch: {} | ||||||
|
||||||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||||||
|
||||||
jobs: | ||||||
state: | ||||||
name: Check state | ||||||
permissions: | ||||||
pull-requests: read | ||||||
runs-on: ubuntu-latest | ||||||
steps: | ||||||
- uses: actions/checkout@v3 | ||||||
- name: Set up environment | ||||||
uses: ./.github/actions/setup | ||||||
- id: state | ||||||
name: Get state | ||||||
uses: actions/github-script@v6 | ||||||
env: | ||||||
TRIGGERING_ACTOR: ${{ github.triggering_actor }} | ||||||
with: | ||||||
result-encoding: string | ||||||
script: await require('./scripts/release/workflow/state.js')({ github, context, core }) | ||||||
outputs: | ||||||
# Job Flags | ||||||
start: ${{ steps.state.outputs.start }} | ||||||
changesets: ${{ steps.state.outputs.changesets }} | ||||||
promote: ${{ steps.state.outputs.promote }} | ||||||
publish: ${{ steps.state.outputs.publish }} | ||||||
merge: ${{ steps.state.outputs.merge }} | ||||||
|
||||||
# Global variables | ||||||
is_prerelease: ${{ steps.state.outputs.is_prerelease }} | ||||||
|
||||||
start: | ||||||
needs: state | ||||||
name: Start new release candidate | ||||||
permissions: | ||||||
contents: write | ||||||
actions: write | ||||||
if: needs.state.outputs.start == 'true' | ||||||
runs-on: ubuntu-latest | ||||||
steps: | ||||||
- uses: actions/checkout@v3 | ||||||
- name: Set up environment | ||||||
uses: ./.github/actions/setup | ||||||
- run: bash scripts/git-user-config.sh | ||||||
- id: start | ||||||
name: Create branch with release candidate | ||||||
run: bash scripts/release/workflow/start.sh | ||||||
- name: Re-run workflow | ||||||
uses: actions/github-script@v6 | ||||||
env: | ||||||
REF: ${{ steps.start.outputs.branch }} | ||||||
with: | ||||||
script: await require('./scripts/release/workflow/rerun.js')({ github, context }) | ||||||
|
||||||
promote: | ||||||
needs: state | ||||||
name: Promote to final release | ||||||
permissions: | ||||||
contents: write | ||||||
actions: write | ||||||
if: needs.state.outputs.promote == 'true' | ||||||
runs-on: ubuntu-latest | ||||||
steps: | ||||||
- uses: actions/checkout@v3 | ||||||
- name: Set up environment | ||||||
uses: ./.github/actions/setup | ||||||
- run: bash scripts/git-user-config.sh | ||||||
- name: Exit prerelease state | ||||||
if: needs.state.outputs.is_prerelease == 'true' | ||||||
run: bash scripts/release/workflow/exit-prerelease.sh | ||||||
- name: Re-run workflow | ||||||
uses: actions/github-script@v6 | ||||||
with: | ||||||
script: await require('./scripts/release/workflow/rerun.js')({ github, context }) | ||||||
|
||||||
changesets: | ||||||
needs: state | ||||||
name: Changesets PR | ||||||
permissions: | ||||||
contents: write | ||||||
pull-requests: write | ||||||
if: needs.state.outputs.changesets == 'true' | ||||||
runs-on: ubuntu-latest | ||||||
steps: | ||||||
- uses: actions/checkout@v3 | ||||||
with: | ||||||
fetch-depth: 0 # To get all tags | ||||||
- name: Set up environment | ||||||
uses: ./.github/actions/setup | ||||||
- name: Set release title | ||||||
uses: actions/github-script@v6 | ||||||
with: | ||||||
result-encoding: string | ||||||
script: await require('./scripts/release/workflow/set-changesets-pr-title.js')({ core }) | ||||||
- name: Create PR | ||||||
uses: changesets/action@v1 | ||||||
env: | ||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
PRERELEASE: ${{ needs.state.outputs.is_prerelease }} | ||||||
with: | ||||||
version: npm run version | ||||||
title: ${{ env.TITLE }} | ||||||
commit: ${{ env.TITLE }} | ||||||
body: | # Wait for support on this https://github.com/changesets/action/pull/250 | ||||||
This is an automated PR for releasing ${{ github.repository }} | ||||||
Check [CHANGELOG.md](${{ github.repository }}/CHANGELOG.md) | ||||||
|
||||||
publish: | ||||||
needs: state | ||||||
name: Publish to npm | ||||||
environment: npm | ||||||
permissions: | ||||||
contents: write | ||||||
if: needs.state.outputs.publish == 'true' | ||||||
runs-on: ubuntu-latest | ||||||
steps: | ||||||
- uses: actions/checkout@v3 | ||||||
- name: Set up environment | ||||||
uses: ./.github/actions/setup | ||||||
- id: pack | ||||||
name: Pack | ||||||
run: bash scripts/release/workflow/pack.sh | ||||||
env: | ||||||
PRERELEASE: ${{ needs.state.outputs.is_prerelease }} | ||||||
- name: Tag | ||||||
run: npx changeset tag | ||||||
- name: Publish | ||||||
run: bash scripts/release/workflow/publish.sh | ||||||
env: | ||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||||||
TARBALL: ${{ steps.pack.outputs.tarball }} | ||||||
TAG: ${{ steps.pack.outputs.tag }} | ||||||
- name: Push tags | ||||||
run: git push --tags | ||||||
- name: Create Github Release | ||||||
uses: actions/github-script@v6 | ||||||
env: | ||||||
PRERELEASE: ${{ needs.state.outputs.is_prerelease }} | ||||||
with: | ||||||
script: await require('./scripts/release/workflow/github-release.js')({ github, context }) | ||||||
|
||||||
merge: | ||||||
needs: state | ||||||
name: Release PR back to master | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
permissions: | ||||||
contents: write | ||||||
pull-requests: write | ||||||
if: needs.state.outputs.merge == 'true' | ||||||
runs-on: ubuntu-latest | ||||||
steps: | ||||||
- uses: actions/checkout@v3 | ||||||
with: | ||||||
fetch-depth: 0 # All branches | ||||||
- name: Set up environment | ||||||
uses: ./.github/actions/setup | ||||||
- run: bash scripts/git-user-config.sh | ||||||
- name: Create branch to merge | ||||||
run: bash scripts/release/workflow/prepare-release-merge.sh | ||||||
- name: Create PR back to master | ||||||
uses: actions/github-script@v6 | ||||||
with: | ||||||
script: | | ||||||
await github.rest.pulls.create({ | ||||||
owner: context.repo.owner, | ||||||
repo: context.repo.repo, | ||||||
head: 'merge/${{ github.ref_name }}', | ||||||
base: 'master', | ||||||
title: '${{ format('Merge {0} branch', github.ref_name) }}' | ||||||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.