Skip to content

Commit

Permalink
add prepare-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
martriay committed Dec 29, 2023
1 parent 441e6ce commit 2a6632f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Update version on new release branch

on:
create:

jobs:
update_version:
if: github.ref_type == 'branch' && startsWith(github.ref, 'refs/heads/release-v')
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Extract current version
id: current-version
run: |
CURRENT_VERSION=$(grep 'version = ' Scarb.toml | sed 's/version = "\(.*\)"/\1/')
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
- name: Extract new version number
id: new-version
run: echo "NEW_VERSION=${GITHUB_REF#refs/heads/release-v}" >> $GITHUB_ENV

- name: Replace version in files
run: |
echo "Current version: ${{ env.CURRENT_VERSION }}"
echo "New version: ${{ env.NEW_VERSION }}"
find . -type f -not -path '*/\.*' -exec sed -i "s/${{ env.CURRENT_VERSION }}/${{ env.NEW_VERSION }}/g" {} +
find . -type f -not -path '*/\.*' -not -name 'CHANGELOG.md' -exec sed -i "s/${{ env.CURRENT_VERSION }}/${{ env.NEW_VERSION }}/g" {} +
10 changes: 4 additions & 6 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,20 @@
git checkout -b release-v0.8.0
```

(3) Search and replace the current release version with the one to be released (e.g. `0.7.0` to `0.8.0`, or `0.8.0-beta.0` to `0.8.0-beta.1`).
(3) Create the release entry in [the changelog](CHANGELOG.md) with the contents of the _Unreleased_ section, which should be left empty.

(4) Create the release entry in [the changelog](CHANGELOG.md) with the contents of the _Unreleased_ section, which should be left empty.

(5) Push and open a PR targeting `main` to carefully review the release changes.
(4) Push and open a PR targeting `main` to carefully review the release changes. This will trigger a Github workflow that automatically bumps the version number throughout the project.

```sh
git push release-v0.8.0
```

(6) Once merged, create a tag on the release branch and push it to the main repository.
(5) Once merged, create a tag on the release branch and push it to the main repository.

```sh
git tag v0.8.0
git push origin v0.8.0
```

(7) Finally, go to the repo's [releases page](https://github.com/OpenZeppelin/cairo-contracts/releases/) and [create a new one](https://github.com/OpenZeppelin/cairo-contracts/releases/new) with the new tag and the base branch as target (`main` except in the event of a hotfix).
(6) Finally, go to the repo's [releases page](https://github.com/OpenZeppelin/cairo-contracts/releases/) and [create a new one](https://github.com/OpenZeppelin/cairo-contracts/releases/new) with the new tag and the base branch as target (`main` except in the event of a hotfix).
Make sure to write a detailed release description and a short changelog.

0 comments on commit 2a6632f

Please sign in to comment.