@@ -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
@@ -199,10 +203,12 @@ jobs:
199203 needs : build-docs
200204 runs-on : ubuntu-latest
201205
202- # Publish docs to RTD when tagged
203- if : github.ref_type == 'tag'
206+ # Publish docs to RTD when merged to and tagged on master
207+ if : github.ref_type == 'tag' || github.event.inputs.release_tag != ''
204208
205209 steps :
210+ - run : echo "Publishing RTD for tag ${{ github.ref_type == 'tag' && github.ref_name || github.event.inputs.release_tag }}"
211+
206212 - name : Debug GitHub context
207213 run : |
208214 echo "github.ref: ${{ github.ref }}"
@@ -232,8 +238,8 @@ jobs:
232238 needs : build-package
233239 runs-on : ubuntu-latest
234240
235- # Publish to PyPI when tagged
236- if : github.ref_type == 'tag'
241+ # Publish to PyPI when merged to and tagged on master
242+ if : github.ref_type == 'tag' || github.event.inputs.release_tag != ''
237243
238244 environment :
239245 name : pypi
@@ -243,6 +249,8 @@ jobs:
243249 id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
244250
245251 steps :
252+ - run : echo "Publishing PyPI for tag ${{ github.ref_type == 'tag' && github.ref_name || github.event.inputs.release_tag }}"
253+
246254 - name : Debug GitHub context
247255 run : |
248256 echo "github.ref: ${{ github.ref }}"
0 commit comments