Skip to content

Commit 7d7dd9f

Browse files
Feat #63: Add version consistency check to release workflow (#86)
* feat #63: Add version consistency check to release workflow Signed-off-by: sushant-suse <[email protected]> * feat #63: Add changelog fil Signed-off-by: sushant-suse <[email protected]> * Update .github/workflows/release.yml Co-authored-by: Tom Schraitle <[email protected]> --------- Signed-off-by: sushant-suse <[email protected]> Co-authored-by: Tom Schraitle <[email protected]>
1 parent 1c449da commit 7d7dd9f

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ jobs:
4545
- name: Checkout code
4646
uses: actions/checkout@v4
4747

48+
- name: Check Version Consistency
49+
id: version_check
50+
run: |
51+
BRANCH_VERSION="${{ env.VERSION }}"
52+
53+
# Safely extract __version__ from the file (for example, '1.0.0' from __version__ = '1.0.0')
54+
CODE_VERSION=$(grep '__version__' src/docbuild/__about__.py | awk -F "'" '{print $2}')
55+
56+
echo ":notice title=Branch version::$BRANCH_VERSION"
57+
echo ":notice title=Code version::$CODE_VERSION"
58+
59+
if [ "$BRANCH_VERSION" != "$CODE_VERSION" ]; then
60+
echo "::error file=src/docbuild/__about__.py::Release branch version ($BRANCH_VERSION) does not match code version ($CODE_VERSION) in __about__.py."
61+
echo "ERROR: Version mismatch detected! The release branch name must exactly match the __version__ in the code."
62+
exit 1
63+
fi
64+
echo "Version check passed: $BRANCH_VERSION matches $CODE_VERSION."
65+
4866
- name: Setup uv
4967
id: setup-uv
5068
uses: astral-sh/setup-uv@v6

changelog.d/86.infra.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added a check to the release workflow to ensure the branch version matches the code's __version__ string.

0 commit comments

Comments
 (0)