Workflow file for this run
This file contains 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
# This workflow will build the package and publish it to PyPI when a GitHub release is created | |
# For more information see: | |
# https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-python#publishing-to-pypi | |
# https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-pypi | |
name: Upload Package to PyPI | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
release-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
- name: Build release distributions | |
run: | | |
python -m pip install build | |
python -m build | |
- name: Upload release distributions | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
pypi-publish: | |
runs-on: ubuntu-latest | |
needs: | |
- release-build | |
permissions: | |
id-token: write | |
environment: | |
name: pypi | |
steps: | |
- name: Retrieve release distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
# GitHub recommends pinning actions to a commit SHA. | |
# To get a newer version, we will need to update the SHA periodically. | |
- name: Publish release distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc |