Skip to content

Commit 8dc35ea

Browse files
committed
feat: Add ref input to publish workflow for tag-specific builds
When using workflow_dispatch, you can now specify a git ref (e.g., v0.1.6) to build from. This ensures setuptools-scm generates the correct version instead of a dev version with local identifier that PyPI rejects.
1 parent ed91428 commit 8dc35ea

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@ on:
55
branches: [main, master]
66
pull_request:
77
workflow_dispatch:
8+
inputs:
9+
ref:
10+
description: 'Git ref to build from (tag like v0.1.6)'
11+
required: false
12+
type: string
813
workflow_call:
14+
inputs:
15+
ref:
16+
description: 'Git ref to build from'
17+
required: false
18+
type: string
919

1020
env:
1121
# CFD C library version to build against
@@ -29,6 +39,7 @@ jobs:
2939
- uses: actions/checkout@v4
3040
with:
3141
fetch-depth: 0
42+
ref: ${{ inputs.ref || github.ref }}
3243

3344
- name: Checkout CFD C library
3445
uses: actions/checkout@v4

.github/workflows/publish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
options:
1717
- testpypi
1818
- pypi
19+
ref:
20+
description: 'Git ref to build from (tag like v0.1.6, or leave empty for default branch)'
21+
required: false
22+
type: string
1923

2024
# Prevent duplicate runs when release creates a tag
2125
concurrency:
@@ -25,6 +29,8 @@ concurrency:
2529
jobs:
2630
build:
2731
uses: ./.github/workflows/build-wheels.yml
32+
with:
33+
ref: ${{ inputs.ref || github.ref }}
2834

2935
build_sdist:
3036
name: Build source distribution
@@ -34,6 +40,7 @@ jobs:
3440
- uses: actions/checkout@v4
3541
with:
3642
fetch-depth: 0
43+
ref: ${{ inputs.ref || github.ref }}
3744

3845
- name: Set up Python
3946
uses: actions/setup-python@v5

0 commit comments

Comments
 (0)