Skip to content

Commit

Permalink
CI: split pypi build and deploy tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Puerling committed Dec 6, 2024
1 parent a5bad0d commit 41e98c2
Showing 1 changed file with 44 additions and 16 deletions.
60 changes: 44 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ jobs:
path: ui-cpp/ui-imgui/webapp/
if-no-files-found: error

deploy-pypi:
build-pypi:
if: github.event_name != 'pull_request'
needs:
- lint
Expand All @@ -780,7 +780,13 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- platform: linux
os: ubuntu-latest
- platform: macos
os: macos-latest
- platform: windows
os: windows-latest
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF
Expand Down Expand Up @@ -823,21 +829,43 @@ jobs:
echo "Add suffix to spirit version tag for python package $SPIRIT_ADD_VERSION_SUFFIX"
python setup.py sdist bdist_wheel
- name: πŸš€ Deploy to TestPyPI
working-directory: ./core/python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref != 'refs/heads/master'
run: twine upload --skip-existing --repository testpypi dist/*
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.platform }}
path: ./core/python/dist
if-no-files-found: error

- name: πŸš€ Deploy to PyPI
working-directory: ./core/python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref == 'refs/heads/master'
run: twine upload --skip-existing dist/*
deploy-pypi:
if: github.event_name != 'pull_request'
needs: ['build-pypi']
environment: 'publish'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/download-artifact@v4

- name: πŸ“š Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install twine
- name: πŸš€ Deploy to TestPyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref != 'refs/heads/master'
run: twine upload --skip-existing --repository testpypi dist/*

- name: πŸš€ Deploy to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref == 'refs/heads/master'
run: twine upload --skip-existing dist/*

deploy-package:
if: github.event_name != 'pull_request'
Expand Down

0 comments on commit 41e98c2

Please sign in to comment.