Skip to content

Commit 68aae66

Browse files
committed
fix: dont ask for version in bump_version script if already on tag and pyproject updated
1 parent d7f170c commit 68aae66

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/bump_version.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ git pull
1010
VERSION_TAG=$(git describe --tags --abbrev=0 | cut -b 2-)
1111
VERSION_PYPROJECT=$(poetry version --short)
1212

13+
IS_COMMIT_TAGGED=$(git tag --points-at HEAD | grep -q "^v[0-9]\+\.[0-9]\+\.[0-9]\+$" && echo "true" || echo "false")
14+
15+
# if we're already on a tagged commit, and the versions match, exit with 0
16+
if [ "${VERSION_TAG}" == "${VERSION_PYPROJECT}" ] && [ "${IS_COMMIT_TAGGED}" == "true" ]; then
17+
echo "Version ${VERSION_TAG} is already tagged, assuming up-to-date"
18+
exit 0
1319
# if the version in pyproject.toml is not the same as the latest tag, we need to bump the version
14-
if [ "${VERSION_TAG}" != "${VERSION_PYPROJECT}" ]; then
20+
elif [ "${VERSION_TAG}" != "${VERSION_PYPROJECT}" ]; then
1521
echo "The latest tag is ${VERSION_TAG} but the version in pyproject.toml is ${VERSION_PYPROJECT}"
1622
echo "Updating the version in pyproject.toml to match the latest tag"
1723
poetry version ${VERSION}

0 commit comments

Comments
 (0)