Skip to content

Commit b7c0182

Browse files
committed
ci: run workflow on version tags so PyPI publish is not skipped
Made-with: Cursor
1 parent cb05589 commit b7c0182

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
name: CI
22

3+
# Tag pushes must be listed explicitly; branch-only `push` does not run on new tags,
4+
# so "Publish to PyPI" would always be skipped without `tags:` here.
35
on:
46
push:
57
branches: [main, dev]
8+
tags:
9+
- "v*"
610
pull_request:
711
branches: [main]
12+
workflow_dispatch:
13+
inputs:
14+
publish_to_pypi:
15+
description: "Publish to PyPI after tests (only if this version is not already on PyPI)"
16+
required: false
17+
default: false
18+
type: boolean
819

920
jobs:
1021
test:
@@ -47,7 +58,13 @@ jobs:
4758
name: Publish to PyPI
4859
runs-on: ubuntu-latest
4960
needs: test
50-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
61+
# Runs after a version tag push (e.g. v0.1.3), or manual run with publish enabled.
62+
if: |
63+
needs.test.result == 'success' &&
64+
(
65+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) ||
66+
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_pypi == 'true')
67+
)
5168
5269
steps:
5370
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)