From fb6dffd8b3c9460ee48f0d0e2ecd017dab2dfcea Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Thu, 11 Dec 2025 19:21:50 -0800 Subject: [PATCH] ci: Add publish workflow Signed-off-by: Eli Uriegas --- .github/workflows/publish.yml | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a2b7695 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,38 @@ +name: Publish to PyPI + +on: + push: + tags: + - "v*" + +jobs: + publish: + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + attestations: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.13" + - name: Verify tag matches package version + run: | + PKG_VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") + TAG_VERSION=${GITHUB_REF#refs/tags/v} + if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then + echo "::error::Tag version ($TAG_VERSION) does not match package version ($PKG_VERSION)" + exit 1 + fi + - name: Build package + run: uv build + - name: Generate attestations + uses: actions/attest-build-provenance@v2 + with: + subject-path: dist/* + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1