Skip to content

Commit

Permalink
CICD: Switch to trusted publisher based auth for releases to PyPi
Browse files Browse the repository at this point in the history
  • Loading branch information
RUrlus committed May 13, 2024
1 parent 2aee019 commit c11a0cf
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,37 @@ jobs:
name: artifact-macos-x86-64
path: wheelhouse/*.whl

upload_all:
name: Upload if release
publish-to-testpypi:
name: Publish release on TestPyPi
needs: [build_sdist, build_wheels, build_macos_intel]
runs-on: ubuntu-latest
environment: testrelease
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip_existing: true

pypi-publish:
name: Publish release on PyPi
needs: [build_sdist, build_wheels, build_macos_intel, publish-to-testpypi]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment: release
permissions:
id-token: write

steps:
- uses: actions/setup-python@v5
Expand All @@ -123,5 +149,4 @@ jobs:

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USER }}
password: ${{ secrets.PYPI_PASS }}
skip_existing: true

0 comments on commit c11a0cf

Please sign in to comment.