Skip to content

Commit

Permalink
Add CI version bump (#862)
Browse files Browse the repository at this point in the history
* add prepare-release.yml

* update changelog

* fix replacement

* fix current version extraction

* add autocommit

* fix autocommit

* exclude package-lock and releasing from bump

* fix exclusion

* Update .github/workflows/prepare-release.yml

* remove unused step ids

* Update RELEASING.md

Co-authored-by: Andrew Fleming <[email protected]>

* Update .github/workflows/prepare-release.yml

Co-authored-by: Nikita Stupin <[email protected]>

* add GH_PAT to workflow

* update secret name

* update secret name

* update secret name

* fix PAT setting

* Update .github/workflows/prepare-release.yml

Co-authored-by: Andrew Fleming <[email protected]>

---------

Co-authored-by: Andrew Fleming <[email protected]>
Co-authored-by: Nikita Stupin <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2024
1 parent 3baa102 commit 43ca5cd
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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
with:
token: ${{ secrets.OPENZEPPELIN_ORG_GITHUB_PAT }}

- name: Extract 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
run: echo "NEW_VERSION=${GITHUB_REF#refs/heads/release-v}" >> $GITHUB_ENV

- name: Replace version in files
run: |
echo "Current version: $CURRENT_VERSION"
echo "New version: $NEW_VERSION"
find . -type f -not -path '*/\.*' -not -path './CHANGELOG.md' -not -path './docs/package-lock.json' -not -path './RELEASING.md' -exec sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g" {} +
- name: Auto-commit changes
uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a #v4.16.0
with:
commit_message: Bump version to ${{ env.NEW_VERSION }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Utilities documentation (#825)
- Documentation for presets (#832)
- Backwards compatibility notice (#861)
- Add automatic version bump to CI (#862)

### Changed

Expand Down
12 changes: 6 additions & 6 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
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, pull the changes from the release branch.
Then, create a tag on the release branch and push it to the main repository.

```sh
git pull
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 43ca5cd

Please sign in to comment.