fix: update python-semantic-release to fix release process (#1426) · python-zeroconf/python-zeroconf@2f20155
@@ -93,36 +93,54 @@ jobs:
9393token: ${{ secrets.CODECOV_TOKEN }}
94949595release:
96-runs-on: ubuntu-latest
97-environment: release
98-if: github.ref == 'refs/heads/master'
9996needs:
10097 - test
10198 - lint
10299 - commitlint
103100101+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+104110steps:
105- - uses: actions/checkout@v3
111+ - uses: actions/checkout@v4
106112with:
107113fetch-depth: 0
114+ref: ${{ github.head_ref || github.ref_name }}
108115109-# 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'
120138with:
121139github_token: ${{ secrets.GITHUB_TOKEN }}
122-pypi_token: ${{ secrets.PYPI_TOKEN }}
123140124141build_wheels:
125142needs: [release]
143+if: needs.release.outputs.released == 'true'
126144127145name: Build wheels on ${{ matrix.os }}
128146runs-on: ${{ matrix.os }}
@@ -139,6 +157,8 @@ jobs:
139157# Used to host cibuildwheel
140158 - name: Set up Python
141159uses: actions/setup-python@v5
160+with:
161+python-version: "3.11"
142162143163 - name: Install python-semantic-release
144164run: pipx install python-semantic-release==7.34.6
@@ -161,7 +181,7 @@ jobs:
161181platforms: arm64
162182163183 - 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:
166186env:
167187CIBW_SKIP: cp36-* cp37-* pp36-* pp37-* *p38-*_aarch64 cp38-*_arm64 *p39-*_aarch64 *p310-*_aarch64 pp*_aarch64 *musllinux*_aarch64