Skip to content

Commit

Permalink
fix fetching latest tag
Browse files Browse the repository at this point in the history
  • Loading branch information
irenaby committed Sep 10, 2024
1 parent 704e540 commit 68d5771
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,16 @@ jobs:
shell: bash
run : |
pip install packaging
git fetch --tags
latest_tag=$(git tag -l | sort -V -r | head -n 1)
if [ -z "$latest_tag" ]; then
new_version=0.0.0.dev0
else
latest_tag_without_v=${latest_tag#v}
new_version=$(python -c "
latest_tag=$(git describe --tags --abbrev=0)
latest_tag_without_v=${latest_tag#v}
new_version=$(python -c "
from packaging.version import parse
v = parse('$latest_tag_without_v')
if v.is_devrelease:
print(f'{v.major}.{v.minor}.{v.micro}.dev{v.dev + 1}')
else:
print(f'{v.major}.{v.minor+1}.{v.micro}.dev0')
")
fi
echo "new_ver=${new_version}" >> $GITHUB_ENV
echo "new_tag=v${new_version}" >> $GITHUB_ENV
echo "cat GITHUB_ENV"
Expand Down

0 comments on commit 68d5771

Please sign in to comment.