Skip to content

Commit

Permalink
chore: support trusted publisher to publish with OIDC (#888)
Browse files Browse the repository at this point in the history
Signed-off-by: miurahr <[email protected]>
  • Loading branch information
miurahr authored Feb 22, 2025
1 parent 5d699b9 commit 39ae494
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
- v*

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
build:
name: Build package
runs-on: ubuntu-22.04
steps:
- name: Checkout 🛎️
Expand All @@ -30,6 +30,23 @@ jobs:
run: python -m build ./
- name: twine check
run: python -m twine check dist/*
- name: upload dists
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

publish:
name: publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-22.04
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish distribution 📦 to Test PyPI when releases branch
if: ${{ startsWith(github.event.ref, 'refs/heads/releases') }}
uses: pypa/gh-action-pypi-publish@release/v1
Expand All @@ -39,5 +56,3 @@ jobs:
- name: Publish distribution 📦 to PyPI
if: ${{ startsWith(github.event.ref, 'refs/tags') }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}

0 comments on commit 39ae494

Please sign in to comment.