Skip to content

Commit

Permalink
ci: Enforce release version check when pushing tags (#434) (#437)
Browse files Browse the repository at this point in the history
Follow-up to #427. The workflow in #427 is merely informational, which is helpful, but can be bypassed. It's probably best to enforce this check when we push tags.

If the check fails, it will prevent the cutting of a release, meaning we'll have to delete the tag, fix the version number, and tag again.

---

#### PR checklist

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments

(cherry picked from commit 0d3c2f3)

Co-authored-by: Thane Thomson <connect@thanethomson.com>
  • Loading branch information
mergify[bot] and thanethomson authored Mar 1, 2023
1 parent 1ad88b8 commit ea7190a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ jobs:
with:
go-version: '1.19'

# Similar check to ./release-version.yml, but enforces this when pushing
# tags. The ./release-version.yml check can be bypassed and is mainly
# present for informational purposes.
- name: Check release version
run: |
# We strip the refs/tags/v prefix of the tag name.
TAG_VERSION=${GITHUB_REF#refs/tags/v}
# Get the version of the code, which has no "v" prefix.
CODE_VERSION=`go run ./cmd/cometbft/ version`
if [ "$TAG_VERSION" != "$CODE_VERSION" ]; then
echo ""
echo "Tag version ${TAG_VERSION} does not match code version ${CODE_VERSION}"
echo ""
echo "Please either fix the release tag or the version of the software in version/version.go."
exit 1
fi
- name: Generate release notes
run: |
VERSION="${GITHUB_REF#refs/tags/}"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
# Get the version of the code, which has no "v" prefix.
CODE_VERSION=`go run ./cmd/cometbft/ version`
if [ "$BRANCH_VERSION" != "$CODE_VERSION" ]; then
echo ""
echo "Branch version ${BRANCH_VERSION} does not match code version ${CODE_VERSION}"
echo ""
echo "Please either fix the release branch naming (which must have a 'release/v' prefix)"
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ jobs:
with:
go-version: '1.19'

# Similar check to ./release-version.yml, but enforces this when pushing
# tags. The ./release-version.yml check can be bypassed and is mainly
# present for informational purposes.
- name: Check release version
run: |
# We strip the refs/tags/v prefix of the tag name.
TAG_VERSION=${GITHUB_REF#refs/tags/v}
# Get the version of the code, which has no "v" prefix.
CODE_VERSION=`go run ./cmd/cometbft/ version`
if [ "$TAG_VERSION" != "$CODE_VERSION" ]; then
echo ""
echo "Tag version ${TAG_VERSION} does not match code version ${CODE_VERSION}"
echo ""
echo "Please either fix the release tag or the version of the software in version/version.go."
exit 1
fi
- name: Generate release notes
run: |
VERSION="${GITHUB_REF#refs/tags/}"
Expand Down

0 comments on commit ea7190a

Please sign in to comment.