v0.5.6 #44
Workflow file for this run
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
| name: Publish to PyPI | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Release tag to publish (e.g. v0.11.0). Leave empty to use the current ref." | |
| required: false | |
| default: "" | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Determine ref to build | |
| id: ref | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| echo "ref=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" | |
| elif [[ -n "${{ inputs.tag }}" ]]; then | |
| echo "ref=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "ref=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Checkout repo (for tags) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch tags | |
| run: git fetch --tags --force | |
| - name: Checkout ref | |
| run: | | |
| echo "Using ref: ${{ steps.ref.outputs.ref }}" | |
| git checkout "${{ steps.ref.outputs.ref }}" | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Build dists | |
| run: | | |
| python -m pip install --upgrade pip build twine | |
| python -m build | |
| twine check dist/* | |
| - name: Publish to PyPI (Trusted Publishing) | |
| uses: pypa/gh-action-pypi-publish@release/v1 |