Skip to content

Commit f3a1995

Browse files
ci: allow manual wheel build from existing tag via workflow_dispatch
When inputs.tag is provided, skip semantic-release and proceed directly to wheel build using the specified tag. This unblocks releases when branch protection prevents semantic-release from pushing to main.
1 parent be52fb2 commit f3a1995

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
push:
55
branches: [main]
66
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: "Existing tag to build wheels for (e.g. v1.7.0). Skips semantic-release."
10+
required: false
11+
type: string
712

813
permissions:
914
contents: read
@@ -17,26 +22,43 @@ jobs:
1722
permissions:
1823
contents: write
1924
outputs:
20-
released: ${{ steps.semantic-release.outputs.released || 'false' }}
21-
tag: ${{ steps.semantic-release.outputs.tag }}
25+
released: ${{ steps.resolve.outputs.released }}
26+
tag: ${{ steps.resolve.outputs.tag }}
2227
steps:
2328
- name: Checkout release branch
2429
uses: actions/checkout@v4
2530
with:
2631
ref: ${{ github.ref_name }}
2732

2833
- name: Force branch to workflow sha
34+
if: inputs.tag == ''
2935
run: git reset --hard ${{ github.sha }}
3036

3137
- name: Run semantic release
3238
id: semantic-release
39+
if: inputs.tag == ''
3340
uses: python-semantic-release/python-semantic-release@v10.5.3
3441
with:
3542
github_token: ${{ secrets.GITHUB_TOKEN }}
3643
git_committer_name: github-actions
3744
git_committer_email: actions@users.noreply.github.com
3845
build: false
3946

47+
- name: Resolve release outputs
48+
id: resolve
49+
env:
50+
INPUT_TAG: ${{ inputs.tag }}
51+
SR_RELEASED: ${{ steps.semantic-release.outputs.released }}
52+
SR_TAG: ${{ steps.semantic-release.outputs.tag }}
53+
run: |
54+
if [ -n "$INPUT_TAG" ]; then
55+
echo "released=true" >> "$GITHUB_OUTPUT"
56+
echo "tag=$INPUT_TAG" >> "$GITHUB_OUTPUT"
57+
else
58+
echo "released=${SR_RELEASED:-false}" >> "$GITHUB_OUTPUT"
59+
echo "tag=$SR_TAG" >> "$GITHUB_OUTPUT"
60+
fi
61+
4062
build-wheels:
4163
needs: release
4264
if: needs.release.outputs.released == 'true'

0 commit comments

Comments
 (0)