From 9cb8731eca515793fbd7dce7d1fc337656af2091 Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Fri, 8 Dec 2023 14:22:46 -0600 Subject: [PATCH] wheels to pypi --- .github/workflows/build-test.yaml | 4 +-- .github/workflows/wheels.yaml | 56 +++++++++++++++++++++++++------ 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 3e2a636..969395a 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -35,7 +35,7 @@ jobs: platform: [ubuntu-latest, macos-latest] steps: - - uses: lukka/get-cmake@latest + - uses: lukka/get-cmake@v3.27.9 - name: Cache Xerces-C Installation id: cache-xerces @@ -127,7 +127,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - - uses: lukka/get-cmake@latest + - uses: lukka/get-cmake@v3.27.9 - name: Cache Xerces-C Installation id: cache-xerces diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml index 11fc90d..5b47245 100644 --- a/.github/workflows/wheels.yaml +++ b/.github/workflows/wheels.yaml @@ -4,8 +4,11 @@ name: Wheels on: workflow_dispatch: - push: - branches: [main] + inputs: + publish_to_test_pypi: + type: boolean + description: Publish to Test PyPI + default: false env: GEANT4_VERSION: 11.2.0 @@ -24,8 +27,6 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 - with: - python-version: 3.11 - name: Build sdist run: | @@ -34,10 +35,10 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: sdist + name: dist path: dist/*.tar.gz - wheel: + wheels: name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }} @@ -92,12 +93,10 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: lukka/get-cmake@latest + - uses: lukka/get-cmake@v3.27.9 - name: Setup Python uses: actions/setup-python@v5 - with: - python-version: 3.11 - uses: pypa/cibuildwheel@v2.16.2 env: @@ -138,5 +137,42 @@ jobs: - name: Upload Wheels uses: actions/upload-artifact@v3 with: - name: wheels + name: dist path: wheelhouse/*.whl + + upload-test-pypi: + name: Upload wheels to PyPI + needs: [sdist, wheels] + runs-on: ubuntu-latest + if: github.event.inputs.publish_to_test_pypi + + steps: + - uses: actions/setup-python@v4 + - uses: actions/download-artifact@v3 + with: + name: dist + path: dist + + - name: Publish to Test PyPI + uses: pypa/gh-action-pypi-publish@v1.8.11 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + upload-pypi: + name: Upload wheels to PyPI + needs: [sdist, wheels] + runs-on: ubuntu-latest + if: github.event_name == 'release' && github.event.action == 'published' + + steps: + - uses: actions/setup-python@v4 + - uses: actions/download-artifact@v3 + with: + name: dist + path: dist + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@v1.8.11 + with: + password: ${{ secrets.PYPI_API_TOKEN }}