Publish Python Package to PyPI on Release #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GitHub Actions workflow for publishing a Python package to PyPI upon release. | |
| name: Publish Python Package to PyPI on Release | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| pypi-publish: | |
| name: PyPI Release Publication | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for trusted publishing | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Configure Python Environment | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.x" | |
| - name: Configure PDM Environment | |
| uses: pdm-project/setup-pdm@v4 | |
| with: | |
| python-version: "3.x" | |
| cache: true | |
| - name: Build Python Package | |
| run: pdm build | |
| - name: Upload Distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |