Skip to content

Commit a79bf2d

Browse files
Transurgeonclaude
andcommitted
Add manual publish option via workflow_dispatch
Can now trigger from any branch in the Actions UI with a dropdown: - none: build wheels only (CI check) - testpypi: build + publish to TestPyPI - pypi: build + publish to TestPyPI then PyPI Tag pushes still auto-publish to both as before. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7e10d1f commit a79bf2d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/build-and-publish.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ on:
88
- 'v*'
99
pull_request:
1010
workflow_dispatch:
11+
inputs:
12+
publish:
13+
description: 'Publish to PyPI (testpypi, pypi, or none)'
14+
required: false
15+
default: 'none'
16+
type: choice
17+
options:
18+
- none
19+
- testpypi
20+
- pypi
1121

1222
# Only cancels-in-progress on PRs (head_ref only defined in PR, fallback run_id always unique)
1323
concurrency:
@@ -87,7 +97,9 @@ jobs:
8797
environment: testpypi
8898
permissions:
8999
id-token: write
90-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
100+
if: >-
101+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) ||
102+
(github.event_name == 'workflow_dispatch' && (inputs.publish == 'testpypi' || inputs.publish == 'pypi'))
91103
steps:
92104
- uses: actions/download-artifact@v4
93105
with:
@@ -106,7 +118,9 @@ jobs:
106118
environment: pypi
107119
permissions:
108120
id-token: write
109-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
121+
if: >-
122+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) ||
123+
(github.event_name == 'workflow_dispatch' && inputs.publish == 'pypi')
110124
steps:
111125
- uses: actions/download-artifact@v4
112126
with:

0 commit comments

Comments
 (0)