From 1e8211c973db7cd5c859b8237982f84de43fedc8 Mon Sep 17 00:00:00 2001 From: Robert Taylor Date: Sun, 23 Jul 2023 15:38:07 +0000 Subject: [PATCH] Always upload to testing, only upload to real pypi on a tagged release --- .github/workflows/wheels.yml | 55 +++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 2e6a92f2..dc08f881 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -77,27 +77,68 @@ jobs: name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }} path: ./wheelhouse/*.whl + test_upload_pypi: + # TODO: create an sdist that can build without a custom environment + needs: [build_wheels] + runs-on: ubuntu-latest + strategy: + matrix: + buildplat: + - [ubuntu-20.04, manylinux_x86_64] + #- [ubuntu-20.04, musllinux_x86_64] + #- [macos-12, macosx_x86_64] + #- [windows-2019, win_amd64] + python: ["cp39", "cp310", "cp311", "cp312"] # "pp39" + exclude: + # Don't build PyPy 32-bit windows + - buildplat: [windows-2019, win32] + python: "pp39" + - buildplat: [ ubuntu-20.04, musllinux_x86_64 ] + python: "pp39" + + environment: pypi + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v3 + with: + name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }} + path: dist + + - uses: pypa/gh-action-pypi-publish@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8 #v1.8.8 + with: + repository_url: https://test.pypi.org/legacy/ + upload_pypi: # TODO: create an sdist that can build without a custom environment needs: [build_wheels] runs-on: ubuntu-latest + strategy: + matrix: + buildplat: + - [ubuntu-20.04, manylinux_x86_64] + #- [ubuntu-20.04, musllinux_x86_64] + #- [macos-12, macosx_x86_64] + #- [windows-2019, win_amd64] + python: ["cp39", "cp310", "cp311", "cp312"] # "pp39" + exclude: + # Don't build PyPy 32-bit windows + - buildplat: [windows-2019, win32] + python: "pp39" + - buildplat: [ ubuntu-20.04, musllinux_x86_64 ] + python: "pp39" + environment: pypi permissions: id-token: write - #if: github.event_name == 'release' && github.event.action == 'published' if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/download-artifact@v3 with: - # unpacks default artifact into dist/ - # if `name: artifact` is omitted, the action will create extra parent dir - name: artifact + name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }} path: dist - uses: pypa/gh-action-pypi-publish@release/v1 - with: - # Testing for now - repository_url: https://test.pypi.org/legacy/ # # build_sdist: # name: Build sdist