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