From d30e948f96bca16ad26c5465d0e96ca3574e4253 Mon Sep 17 00:00:00 2001 From: Ayala Shachar Date: Wed, 1 Oct 2025 15:33:34 +0300 Subject: [PATCH] CI: Add publish job --- .github/workflows/{test.yml => main.yml} | 38 ++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) rename .github/workflows/{test.yml => main.yml} (59%) diff --git a/.github/workflows/test.yml b/.github/workflows/main.yml similarity index 59% rename from .github/workflows/test.yml rename to .github/workflows/main.yml index e3ff1d23..42239bda 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,4 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python application +name: CI on: push: @@ -10,7 +7,7 @@ on: # manually triggered jobs: - Test: + test: runs-on: ubuntu-latest strategy: matrix: @@ -38,3 +35,34 @@ jobs: - name: Test with pytest run: | .venv/bin/pytest + + 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