File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 1313 - run : pip install poetry
1414 - run : poetry install
1515
16- # Check if version already exists on PyPI
17- - name : Check if version exists on PyPI
16+ # Check if version already exists on PyPI and if tag exists
17+ - name : Check if version exists on PyPI and if tag exists
1818 id : version_check
1919 run : |
2020 VERSION=$(poetry run ./current_version.py)
2828 echo "Version $VERSION is new, proceeding with release"
2929 echo "skip_release=false" >> $GITHUB_OUTPUT
3030 fi
31+
32+ # Check if tag already exists
33+ if git tag -l | grep -q "v$VERSION"; then
34+ echo "Tag v$VERSION already exists, skipping tag creation"
35+ echo "skip_tag=true" >> $GITHUB_OUTPUT
36+ else
37+ echo "Tag v$VERSION does not exist, will create it"
38+ echo "skip_tag=false" >> $GITHUB_OUTPUT
39+ fi
40+
41+ # Create tag if it doesn't exist
42+ - name : Create tag if needed
43+ if : steps.version_check.outputs.skip_release != 'true' && steps.version_check.outputs.skip_tag != 'true'
44+ run : |
45+ VERSION=$(poetry run ./current_version.py)
46+ git config --local user.email "[email protected] " 47+ git config --local user.name "GitHub Action"
48+ git tag -a "v$VERSION" -m "Release v$VERSION"
49+ git push origin "v$VERSION"
3150
3251 # Only run the release steps if the version doesn't exist on PyPI
3352 - name : Publish to PyPI
You can’t perform that action at this time.
0 commit comments