Skip to content

Commit 0b0b8b5

Browse files
committed
Fix gha tag trigger (take2) (#1366)
1 parent 789da4d commit 0b0b8b5

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

.github/workflows/tox.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
name: gh
22

33
on:
4+
create: # is used for publishing to PyPI and TestPyPI
5+
tags: # any tag regardless of its name, no branches
6+
- "**"
47
push: # only publishes pushes to the main branch to TestPyPI
58
branches: # any integration branch but not tag
69
- "master"
7-
tags:
8-
- "**"
910
pull_request:
11+
release:
12+
types:
13+
- published # It seems that you can publish directly without creating
14+
- prereleased
1015
schedule:
1116
- cron: 1 0 * * * # Run daily at 0:01 UTC
1217
# Run every Friday at 18:02 UTC
@@ -234,17 +239,15 @@ jobs:
234239
- name: Build dists
235240
run: python -m tox -p auto --parallel-live -vvvv
236241
- name: Publish to test.pypi.org
237-
if: >-
238-
github.event_name == 'push' &&
239-
startsWith(github.ref, 'refs/tags/')
242+
if: >- # "create" workflows run separately from "push" & "pull_request"
243+
github.event_name == 'release'
240244
uses: pypa/gh-action-pypi-publish@master
241245
with:
242246
password: ${{ secrets.testpypi_password }}
243247
repository_url: https://test.pypi.org/legacy/
244248
- name: Publish to pypi.org
245-
if: >-
246-
github.event_name == 'push' &&
247-
startsWith(github.ref, 'refs/tags/')
249+
if: >- # "create" workflows run separately from "push" & "pull_request"
250+
github.event_name == 'release'
248251
uses: pypa/gh-action-pypi-publish@master
249252
with:
250253
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)