From bcdad1d5b6d0fd5440044872c24f1728811e0c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=BCller?= Date: Sat, 22 Jun 2024 20:42:33 +0200 Subject: [PATCH] feat: release package with github action --- .github/workflows/release-please.yaml | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index edf8e1d..503b8c4 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -12,7 +12,65 @@ name: release-please jobs: release-please: runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} steps: - uses: googleapis/release-please-action@v4 with: release-type: python + + build: + if: ${{ jobs.release-please.outputs.release_created }} + needs: release-please + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Install hatch + run: pip install hatch --upgrade + - name: Build package + run: hatch build + - name: Upload dists + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + test-pypi-publish: + if: ${{ jobs.release-please.outputs.release_created }} + needs: build + runs-on: ubuntu-latest + environment: + name: test-pypi + url: https://test.pypi.org/p/geometer + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: dists + path: dist/ + - name: Publish package distributions to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + pypi-publish: + if: ${{ jobs.release-please.outputs.release_created }} + needs: test-pypi-publish + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/geometer + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: dists + path: dist/ + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1