Skip to content

Commit

Permalink
🚀 upload to Test PyPI when running CD workflow on pushes to main
Browse files Browse the repository at this point in the history
Signed-off-by: burgholzer <burgholzer@me.com>
  • Loading branch information
burgholzer committed Sep 27, 2024
1 parent aea7573 commit 4fc3515
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,48 @@
name: CD
on:
push:
branches: [main]
release:
types: [published]
workflow_dispatch:
pull_request:
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

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'
Expand All @@ -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
Expand All @@ -39,3 +63,5 @@ jobs:
with:
subject-path: "dist/*"
- uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true

0 comments on commit 4fc3515

Please sign in to comment.