@@ -5,13 +5,15 @@ name: release
55on :
66 # Build wheels on feature branches and PRs (test only)
77 push :
8- branches : ["**"]
8+ branches : ["master"] # run for pushes to master branch
9+ tags : ["v*"] # run for pushes to tags
910 pull_request :
10- branches : [master]
11-
12- # Publish to GitHub Releases when merged to master OR
13- # Publish to PyPI when tagged
11+ branches : [master] # run for pushes to PR-branches targeting master
1412 workflow_dispatch :
13+ inputs :
14+ release_tag :
15+ description : " Tag name to publish (leave empty to skip)"
16+ required : false
1517
1618env :
1719 # Ensure uv and just are available in PATH
2224 name : Build documentation
2325 runs-on : ubuntu-latest
2426
27+ # Build documentation when merged to master
28+
2529 steps :
2630 - name : Checkout code
2731 uses : actions/checkout@v4
6872 name : Build wheels and source distribution
6973 runs-on : ubuntu-latest
7074
75+ # Build wheels and source distribution when merged to master
76+
7177 steps :
7278 - name : Checkout code
7379 uses : actions/checkout@v4
@@ -109,7 +115,6 @@ jobs:
109115 =================
110116
111117 Build Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
112- Container: ${{ matrix.target.base_image }}
113118 Platform: AMD64
114119 Build Method: GitHub Actions + just/uv/venv
115120
@@ -147,7 +152,6 @@ jobs:
147152 runs-on : ubuntu-latest
148153
149154 # Publish to GitHub Releases when merged to master
150- if : github.ref == 'refs/heads/master' && github.event_name == 'push'
151155
152156 steps :
153157 - name : Download build artifacts
@@ -196,10 +200,12 @@ jobs:
196200 needs : build-docs
197201 runs-on : ubuntu-latest
198202
199- # Publish docs to RTD when tagged
200- if : github.ref_type == 'tag'
203+ # Publish docs to RTD when merged to and tagged on master
204+ if : github.ref_type == 'tag' || github.event.inputs.release_tag != ''
201205
202206 steps :
207+ - run : echo "Publishing RTD for tag ${{ github.ref_type == 'tag' && github.ref_name || github.event.inputs.release_tag }}"
208+
203209 - name : Debug GitHub context
204210 run : |
205211 echo "github.ref: ${{ github.ref }}"
@@ -229,8 +235,8 @@ jobs:
229235 needs : build-package
230236 runs-on : ubuntu-latest
231237
232- # Publish to PyPI when tagged
233- if : github.ref_type == 'tag'
238+ # Publish to PyPI when merged to and tagged on master
239+ if : github.ref_type == 'tag' || github.event.inputs.release_tag != ''
234240
235241 environment :
236242 name : pypi
@@ -240,6 +246,8 @@ jobs:
240246 id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
241247
242248 steps :
249+ - run : echo "Publishing PyPI for tag ${{ github.ref_type == 'tag' && github.ref_name || github.event.inputs.release_tag }}"
250+
243251 - name : Debug GitHub context
244252 run : |
245253 echo "github.ref: ${{ github.ref }}"
0 commit comments