Always upload to testing, only upload to real pypi on a tagged release

This commit is contained in:
Robert Taylor 2023-07-23 15:38:07 +00:00 committed by Rob Taylor
parent 760692e496
commit 1e8211c973
1 changed files with 48 additions and 7 deletions

View File

@ -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