v1.19.1 #137
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
| # This workflow will upload the package to PyPi when a release is published | |
| name: Publish Python Package (PyPi) | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| # IMPORTANT: this permission is mandatory for trusted publishing via PyPi | |
| id-token: write | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.x" | |
| - name: Retrieve version from tag name | |
| id: retrieve-version | |
| run: | | |
| tag=${{ github.event.release.tag_name }} | |
| version_number=${tag#?} | |
| echo version: $version_number | |
| echo "version=$version_number" >> $GITHUB_OUTPUT | |
| - name: Bump project version in pyproject.toml and commit changes to current branch and tag | |
| run: | | |
| VERSION=${{ steps.retrieve-version.outputs.version }} | |
| uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add pyproject.toml | |
| git commit -m "Bump package version to ${{ steps.retrieve-version.outputs.version }}." | |
| git tag -f -a ${{ github.event.release.tag_name }} -m "Release ${{ steps.retrieve-version.outputs.version }}." | |
| git push origin HEAD:main | |
| git push origin -f ${{ github.event.release.tag_name }} | |
| - name: Build package | |
| run: | | |
| uv build | |
| - name: Publish package to PyPI | |
| run: | | |
| uv publish |