From 4fc351513402b23de17ce351b38ed6782f4227c4 Mon Sep 17 00:00:00 2001 From: burgholzer Date: Fri, 9 Aug 2024 20:28:03 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20upload=20to=20Test=20PyPI=20when?= =?UTF-8?q?=20running=20CD=20workflow=20on=20pushes=20to=20main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: burgholzer --- .github/workflows/cd.yml | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6f21cb011..080e59972 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,5 +1,7 @@ name: CD on: + push: + branches: [main] release: types: [published] workflow_dispatch: @@ -7,6 +9,11 @@ on: paths: - .github/workflows/cd.yml +permissions: + attestations: write + contents: read + id-token: write + concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true @@ -14,7 +21,28 @@ concurrency: jobs: python-packaging: name: 🐍 Packaging - uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.4 + uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@no-local-version + with: + no-local-version: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} + + deploy-test-pypi: + name: 🚀 Deploy to Test PyPI + runs-on: ubuntu-latest + environment: + name: test-pypi + url: https://test.pypi.org/p/mqt.core + needs: [python-packaging] + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + steps: + - uses: actions/download-artifact@v4 + with: + pattern: cibw-* + path: dist + merge-multiple: true + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + attestations: true deploy: if: github.event_name == 'release' && github.event.action == 'published' @@ -23,10 +51,6 @@ jobs: environment: name: pypi url: https://pypi.org/p/mqt.core - permissions: - id-token: write - attestations: write - contents: read needs: [python-packaging] steps: - uses: actions/download-artifact@v4 @@ -39,3 +63,5 @@ jobs: with: subject-path: "dist/*" - uses: pypa/gh-action-pypi-publish@release/v1 + with: + attestations: true