Publish #9
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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g. 0.2.0)" | |
| required: true | |
| type: string | |
| jobs: | |
| publish: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Create and push tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag "v${{ inputs.version }}" | |
| git push origin "v${{ inputs.version }}" | |
| - name: Set version for build | |
| run: sed -i 's/^version = ".*"/version = "${{ inputs.version }}"/' pyproject.toml | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Build | |
| run: uv build | |
| - name: Publish to PyPI | |
| run: uv publish --trusted-publishing always | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release create "v${{ inputs.version }}" --generate-notes --title "v${{ inputs.version }}" |