From 932bd10f9190733592b628eb2364eca885b4565b Mon Sep 17 00:00:00 2001 From: Ayala Shachar Date: Wed, 1 Oct 2025 15:24:48 +0300 Subject: [PATCH] CI: Add publish job --- .github/workflows/main.yml | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d59a28..248f1e4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,8 +7,7 @@ on: # manually triggered jobs: - build: - + test: runs-on: ubuntu-latest strategy: matrix: @@ -32,3 +31,34 @@ jobs: uv venv uv pip install ".[testing]" .venv/bin/pytest tests + + publish: + if: startsWith(github.ref, 'refs/tags/') + needs: test + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install hatch + run: pip install hatch + + - name: Build package + run: hatch build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + attestations: true + skip-existing: true