From 1ad88b82906aa06eedd1ee1c0d908e5ace45a110 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 1 Mar 2023 09:05:51 -0500 Subject: [PATCH] ci: Add release version check (backport #427) (#429) * ci: Add release version check (#427) * ci: Add release version check Signed-off-by: Thane Thomson * Fix workflow trigger Signed-off-by: Thane Thomson --------- Signed-off-by: Thane Thomson (cherry picked from commit 9d957b9bc9f1533fb25a92918003b249c4cfc075) * Use Go 1.19 in v0.34.x Signed-off-by: Thane Thomson --------- Signed-off-by: Thane Thomson Co-authored-by: Thane Thomson --- .github/workflows/release-version.yml | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/release-version.yml diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml new file mode 100644 index 0000000000..63068bea32 --- /dev/null +++ b/.github/workflows/release-version.yml @@ -0,0 +1,32 @@ +# Checks that, if we're working on a release branch and are about to cut a +# release, we have set the version correctly. +name: Check release version + +on: + push: + branches: + - 'release/**' + +jobs: + check-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-go@v3 + with: + go-version: '1.19' + + - name: Check version + run: | + # We strip the refs/heads/release/v prefix of the branch name. + BRANCH_VERSION=${GITHUB_REF#refs/heads/release/v} + # 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 "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)" + echo "or the version of the software in version/version.go." + exit 1 + fi