Closed Privat33r-dev closed 2 months ago
Should I bump to 2.5.4? Since the latest tag is 2.5.3, but version is toml is mismatching. Normally I suggest to automate workflow to avoid these kind of situations.
Wrote a short script that could be used in .git/hooks/pre-push
with the assumption that the single source of truth for version would be ./pyproject.toml
file:
root_dir=$(git rev-parse --show-toplevel)
current_branch=$(git symbolic-ref --short HEAD)
current_tag=$(git describe --abbrev=0 --tags $current_branch 2>/dev/null)
version=v$(grep -oP -m 1 'version = "\K[^"]+' $root_dir/pyproject.toml)
if [[ "$current_tag" != "$version" ]]; then
echo "Tag version ($current_tag) differs from version in pyproject.toml ($version)"
git tag "$version" -m "Version $version" $current_branch && echo "Tag updated to $version" || echo "Couldn't update tag version"
fi
Made a minor refactoring