Skip to content

Commit ad7fd24

Browse files
committed
chore: validating the version mismatch in workflow and follow same pattern as go sdk
Signed-off-by: Sridhar G K <gksridhar09@gmail.com>
1 parent 5cfadc7 commit ad7fd24

5 files changed

Lines changed: 654 additions & 36 deletions

File tree

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[bumpversion]
22
current_version = 0.28.0
33
commit = True
4-
message = Update version {current_version} -> {new_version}
4+
message = Update version {current_version} -> {new_version} [skip ci]
55

66
[bumpversion:file:ibm_cloud_networking_services/version.py]
77
search = __version__ = '{current_version}'

.github/workflows/build-release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,30 @@ jobs:
8585
pip install bump2version build twine
8686
npm ci
8787
88+
- name: Verify version consistency
89+
run: |
90+
# Extract versions from all files
91+
BUMPVERSION_VERSION=$(grep "current_version" .bumpversion.cfg | cut -d'=' -f2 | tr -d ' ')
92+
SETUP_VERSION=$(grep "__version__ = " setup.py | head -1 | cut -d"'" -f2)
93+
VERSION_PY=$(grep "__version__ = " ibm_cloud_networking_services/version.py | cut -d"'" -f2)
94+
README_VERSION=$(grep "# IBM Cloud Networking Services Python SDK Version" README.md | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
95+
96+
echo "Version in .bumpversion.cfg: $BUMPVERSION_VERSION"
97+
echo "Version in setup.py: $SETUP_VERSION"
98+
echo "Version in version.py: $VERSION_PY"
99+
echo "Version in README.md: $README_VERSION"
100+
101+
# Check if all versions match
102+
if [ "$BUMPVERSION_VERSION" != "$SETUP_VERSION" ] || \
103+
[ "$BUMPVERSION_VERSION" != "$VERSION_PY" ] || \
104+
[ "$BUMPVERSION_VERSION" != "$README_VERSION" ]; then
105+
echo "❌ ERROR: Version mismatch detected!"
106+
echo "All version strings must match before release."
107+
exit 1
108+
fi
109+
110+
echo "✅ All version strings are consistent: $BUMPVERSION_VERSION"
111+
88112
- name: Run semantic-release
89113
env:
90114
GH_TOKEN: ${{ secrets.GH_TOKEN }}

.releaserc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
[
1414
"@semantic-release/git",
1515
{
16-
"message": "chore(release): ${nextRelease.version} release notes\n\n${nextRelease.notes}"
16+
"assets": ["package.json", "setup.py", "ibm_cloud_networking_services/version.py", "README.md", "CHANGELOG.md", ".bumpversion.cfg"],
17+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
18+
"author": {
19+
"name": "IBM",
20+
"email": "devx.network.services@ibm.com"
21+
}
1722
}
1823
],
1924
"@semantic-release/github"

0 commit comments

Comments
 (0)