name: Publish to PyPI on: release: types: [published] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: pypi-publish: name: Build and publish Python distribution to PyPI runs-on: ubuntu-latest # MANDATORY: the workflow must have these permissions to authenticate with PyPI via OIDC permissions: id-token: write contents: read steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install build dependencies run: | python -m pip install --upgrade pip pip install build - name: Build a binary wheel and a source tarball run: python -m build - name: Publish package distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1