@@ -56,30 +56,32 @@ jobs:
5656 shell : bash
5757 release :
5858 runs-on : ubuntu-latest
59- environment : release
6059 needs :
6160 - test
61+ concurrency : release
62+ permissions :
63+ id-token : write
6264
6365 steps :
64- - uses : actions/checkout@v4
65- with :
66- fetch-depth : 0
67- persist-credentials : false
68- # Run semantic release:
69- # - Update CHANGELOG.md
70- # - Update version in code
71- # - Create git tag
72- # - Create GitHub release
73- # - Publish to PyPI
74- - name : Python Semantic Release
75- uses : relekang/python-semantic-release@v7.34.6
76- if : github.ref == 'refs/heads/main'
77- with :
78- github_token : ${{ secrets.GH_TOKEN }}
79- repository_username : __token__
80- repository_password : ${{ secrets.PYPI_TOKEN }}
81- - name : Test release
82- uses : python-semantic-release/python-semantic- release@v7.34.6
83- if : github.ref_name != 'main '
84- with :
85- additional_options : --noop
66+ - uses : actions/checkout@v4
67+ with :
68+ fetch-depth : 0
69+
70+ - name : Python Semantic Release
71+ id : release
72+ if : github.ref == 'refs/heads/main'
73+ uses : python-semantic-release/python-semantic-release@v8.7.0
74+ with :
75+ github_token : ${{ secrets.GITHUB_TOKEN }}
76+
77+ - name : Publish package distributions to PyPI
78+ uses : pypa/gh-action-pypi-publish@v1
79+ # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
80+ # See https://github.com/actions/runner/issues/1173
81+ if : steps.release.outputs.released == 'true'
82+
83+ - name : Publish package distributions to GitHub Releases
84+ uses : python-semantic-release/upload-to-gh- release@v8.7.0
85+ if : steps.release.outputs.released == 'true '
86+ with :
87+ github_token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments