From 9dba5128180bc87b5ff1faae5016f62f07249a13 Mon Sep 17 00:00:00 2001 From: puerling Date: Fri, 6 Dec 2024 15:55:25 +0100 Subject: [PATCH] CI: split pypi build and deploy tasks --- .github/workflows/ci.yml | 52 ++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fde4f6004..e76229f39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -823,21 +823,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@v3 + with: + name: dist-${{ matrix.os }} + 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@v3 + + - 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'