@@ -93,36 +93,54 @@ jobs:
9393 token : ${{ secrets.CODECOV_TOKEN }}
9494
9595 release :
96- runs-on : ubuntu-latest
97- environment : release
98- if : github.ref == 'refs/heads/master'
9996 needs :
10097 - test
10198 - lint
10299 - commitlint
103100
101+ runs-on : ubuntu-latest
102+ environment : release
103+ concurrency : release
104+ permissions :
105+ id-token : write
106+ contents : write
107+ outputs :
108+ released : ${{ steps.release.outputs.released }}
109+
104110 steps :
105- - uses : actions/checkout@v3
111+ - uses : actions/checkout@v4
106112 with :
107113 fetch-depth : 0
114+ ref : ${{ github.head_ref || github.ref_name }}
108115
109- # Run semantic release:
110- # - Update CHANGELOG.md
111- # - Update version in code
112- # - Create git tag
113- # - Create GitHub release
114- # - Publish to PyPI
115- - name : Python Semantic Release
116- uses : relekang/python-semantic-release@v7.34.6
117- # env:
118- # REPOSITORY_URL: https://test.pypi.org/legacy/
119- # TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
116+ # Do a dry run of PSR
117+ - name : Test release
118+ uses : python-semantic-release/python-semantic-release@v9.12.0
119+ if : github.ref_name != 'master'
120+ with :
121+ root_options : --noop
122+
123+ # On main branch: actual PSR + upload to PyPI & GitHub
124+ - name : Release
125+ uses : python-semantic-release/python-semantic-release@v9.12.0
126+ id : release
127+ if : github.ref_name == 'master'
128+ with :
129+ github_token : ${{ secrets.GITHUB_TOKEN }}
130+
131+ - name : Publish package distributions to PyPI
132+ uses : pypa/gh-action-pypi-publish@release/v1
133+ if : steps.release.outputs.released == 'true'
134+
135+ - name : Publish package distributions to GitHub Releases
136+ uses : python-semantic-release/upload-to-gh-release@main
137+ if : steps.release.outputs.released == 'true'
120138 with :
121139 github_token : ${{ secrets.GITHUB_TOKEN }}
122- pypi_token : ${{ secrets.PYPI_TOKEN }}
123140
124141 build_wheels :
125142 needs : [release]
143+ if : needs.release.outputs.released == 'true'
126144
127145 name : Build wheels on ${{ matrix.os }}
128146 runs-on : ${{ matrix.os }}
@@ -139,6 +157,8 @@ jobs:
139157 # Used to host cibuildwheel
140158 - name : Set up Python
141159 uses : actions/setup-python@v5
160+ with :
161+ python-version : " 3.11"
142162
143163 - name : Install python-semantic-release
144164 run : pipx install python-semantic-release==7.34.6
@@ -161,7 +181,7 @@ jobs:
161181 platforms : arm64
162182
163183 - name : Build wheels
164- uses : pypa/cibuildwheel@v2.20.0
184+ uses : pypa/cibuildwheel@v2.21.3
165185 # to supply options, put them in 'env', like:
166186 env :
167187 CIBW_SKIP : cp36-* cp37-* pp36-* pp37-* *p38-*_aarch64 cp38-*_arm64 *p39-*_aarch64 *p310-*_aarch64 pp*_aarch64 *musllinux*_aarch64
0 commit comments