Skip to content

Commit 2d11909

Browse files
committed
Add manual trigger support to publish workflow
Enable workflow_dispatch with tag parameter to allow manual publishing of specific tags. This provides flexibility to republish or trigger releases without requiring a new tag push.
1 parent 3ae6ae8 commit 2d11909

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
22

3-
on: push
3+
on:
4+
push:
5+
workflow_dispatch:
6+
inputs:
7+
tag:
8+
description: 'Tag to publish (e.g., 32.0.1)'
9+
required: true
10+
type: string
411

512
jobs:
613
build-n-publish:
@@ -15,6 +22,7 @@ jobs:
1522
steps:
1623
- uses: actions/checkout@v4
1724
with:
25+
ref: ${{ inputs.tag && format('refs/tags/{0}', inputs.tag) || github.ref }}
1826
fetch-depth: 0
1927
- name: Set up Python 3.9
2028
uses: actions/setup-python@v1
@@ -42,6 +50,6 @@ jobs:
4250
repository-url: https://test.pypi.org/legacy/
4351

4452
- name: Publish distribution 📦 to PyPI
45-
if: startsWith(github.ref, 'refs/tags')
53+
if: startsWith(github.ref, 'refs/tags') || inputs.tag
4654
uses: pypa/gh-action-pypi-publish@release/v1
4755

0 commit comments

Comments
 (0)