v1.9.4 #26
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: # Allow manual triggering | |
| permissions: | |
| contents: read | |
| id-token: write # Required for trusted publishing | |
| jobs: | |
| publish: | |
| name: Build and publish to PyPI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Build distributions | |
| run: uv build | |
| - name: Check if version exists on TestPyPI | |
| id: check-testpypi | |
| run: | | |
| VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2) | |
| if pip index versions langrepl --index-url https://test.pypi.org/simple/ 2>/dev/null | grep -q "$VERSION"; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Version $VERSION already exists on TestPyPI, skipping" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "Version $VERSION not found on TestPyPI, will publish" | |
| fi | |
| - name: Publish to TestPyPI | |
| if: steps.check-testpypi.outputs.exists == 'false' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| print-hash: true | |
| attestations: false | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| print-hash: true | |
| attestations: true |