99name : Upload Python Package
1010
1111on :
12- release :
13- types : [published]
12+ push :
13+ tags :
14+ - " [0-9]+.[0-9]+.[0-9]+"
1415
1516permissions :
1617 contents : write
@@ -34,23 +35,33 @@ jobs:
3435 - name : Test code
3536 run : pytest
3637 - name : Bumpversion
37- run : bumpversion --new-version=${{ github.event.release.tag_name }} minor
38+ run : bumpversion --new-version=${{ github.ref_name }} minor
39+ - name : Fail if bumpversion changed files
40+ run : |
41+ if [ -n "$(git status --porcelain)" ]; then
42+ echo "bumpversion modified files; failing the job."
43+ git status --porcelain
44+ exit 1
45+ else
46+ echo "No changes after bumpversion."
47+ fi
3848 - name : Clean dist/
3949 run : rm dist/* -f
4050 - name : Build package
4151 run : python setup.py sdist bdist_wheel
4252 - name : Check package
4353 run : python -m twine check dist/*
44- - name : Commit version change
45- run : |
46- git config --global user.name 'Github Actions'
47- git config --global user.email '38423143+AndyEveritt@users.noreply.github.com'
48- git commit -am "Release ${{ github.event.release.name }}"
49- git tag -f ${{ github.event.release.tag_name }}
50- git push origin HEAD:master
51- git push origin -f --tags
5254 - name : Publish package
5355 uses : pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241
5456 with :
5557 user : __token__
5658 password : ${{ secrets.PYPI_API_TOKEN }}
59+ - name : Create GitHub Release
60+ uses : actions/create-release@v1
61+ env :
62+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
63+ with :
64+ tag_name : ${{ github.ref_name }}
65+ release_name : ${{ github.ref_name }}
66+ draft : false
67+ prerelease : false
0 commit comments