From 87c41a9f9cfb2834ec2dce61fba6a427f014bc21 Mon Sep 17 00:00:00 2001 From: John Marshall Date: Tue, 23 Jul 2024 14:25:13 +1200 Subject: [PATCH] Run release workflow based on pushing tags or release/* branches Building wheels based on the GitHub Release going live means the wheels take longer to appear than they need to. --- .github/workflows/release.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e3ba36a7..d8bf3c6f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,12 +3,9 @@ name: Publish wheels on: push: branches: - - v[0-9]+.* + - release/* tags: - v[0-9]+.* - release: - types: - - published jobs: build_wheels: @@ -88,7 +85,7 @@ jobs: upload_pypi: needs: [build_wheels, build_sdist] runs-on: ubuntu-latest - environment: ${{ github.event_name == 'release' && 'pypi' || 'testpypi' }} + environment: ${{ github.ref_type == 'tag' && 'pypi' || 'testpypi' }} permissions: id-token: write @@ -101,11 +98,11 @@ jobs: path: dist - name: Publish distribution to Test PyPI - if: github.event_name == 'push' + if: github.ref_type == 'branch' uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ - name: Publish distribution to PyPI - if: github.event_name == 'release' && github.event.action == 'published' + if: github.ref_type == 'tag' uses: pypa/gh-action-pypi-publish@release/v1