0.11.0 #2
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: Release | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: "Dry-run publish target" | |
| required: true | |
| default: "testpypi" | |
| type: choice | |
| options: | |
| - "testpypi" | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| python-version: "3.13" | |
| - name: Check version matches tag (releases only) | |
| if: github.event_name == 'release' | |
| run: | | |
| PYPROJECT_VERSION=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml) | |
| RELEASE_TAG=${{ github.ref_name }} | |
| echo "Pyproject version: $PYPROJECT_VERSION" | |
| echo "Release tag: $RELEASE_TAG" | |
| if [ "$PYPROJECT_VERSION" != "$RELEASE_TAG" ]; then | |
| echo "Version mismatch! pyproject ($PYPROJECT_VERSION) != tag ($RELEASE_TAG)." | |
| exit 1 | |
| fi | |
| - name: Build distribution | |
| run: uv build | |
| - name: Check metadata | |
| run: uvx twine check dist/* | |
| - name: Upload dist artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish-testpypi: | |
| needs: build | |
| if: github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| environment: testpypi | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Download dist artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| publish-pypi: | |
| needs: build | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Download dist artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |