Skip to content

Commit 1adec6b

Browse files
committed
Add manual publish trigger for PyPI
Add workflow_dispatch input `publish` (default: false) and guard the publish job so it runs only on v* tag pushes or when manually triggered with `publish` set to 'true'. This prevents accidental PyPI publishes from arbitrary manual workflow runs.
1 parent 701a917 commit 1adec6b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@ on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
publish:
10+
description: "Publish to PyPI"
11+
required: false
12+
default: "false"
713

814
jobs:
915
build-and-publish:
1016
name: Build and Publish to PyPI
1117
runs-on: ubuntu-latest
18+
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.publish == 'true')
1219

1320
steps:
1421
- name: Checkout code

0 commit comments

Comments
 (0)