Skip to content

Commit

Permalink
use OIDC for publishing to pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmiglio committed Oct 7, 2023
1 parent baf52fb commit c5ec439
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "v*.*.*"

jobs:
deploy:
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -19,9 +19,36 @@ jobs:
cache: "poetry"
- name: Install package and dependencies
run: |
poetry install --without dev
poetry install --without dev --with tests
- name: Build and publish
run: |
poetry version $(git describe --tags --abbrev=0)
poetry build
poetry publish --username ${{ secrets.PYPI_USERNAME }} --password ${{ secrets.PYPI_API_TOKEN }}
- name: Verify wheel using twine
run: |
poetry run twine check dist/* --strict
- name: Upload release distributions
uses: actions/upload-artifact@v3
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
environment:
name: pypi
url: https://pypi.org/p/pymemuc
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v3
with:
name: release-dists
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true

0 comments on commit c5ec439

Please sign in to comment.