name: Publish on: push: tags: - "v*" jobs: publish: name: Build and publish to PyPI runs-on: ubuntu-latest permissions: id-token: write # Trusted publishing steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v4 with: enable-cache: true - name: Set up Python run: uv python install 3.12 - name: Verify tag matches pyproject.toml version run: | TAG="${GITHUB_REF#refs/tags/v}" PKG="$(grep -E '^version = ' pyproject.toml | head -1 | sed -E 's/version = "(.*)"/\1/')" if [ "$TAG" != "$PKG" ]; then echo "Tag v$TAG does not match pyproject.toml version $PKG" exit 1 fi - name: Build distribution run: uv build - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1