Skip to content

Commit

Permalink
Run release workflow based on pushing tags or release/* branches
Browse files Browse the repository at this point in the history
Building wheels based on the GitHub Release going live means the
wheels take longer to appear than they need to.
  • Loading branch information
jmarshall committed Oct 10, 2024
1 parent 453acaa commit 87c41a9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ name: Publish wheels
on:
push:
branches:
- v[0-9]+.*
- release/*
tags:
- v[0-9]+.*
release:
types:
- published

jobs:
build_wheels:
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit 87c41a9

Please sign in to comment.