@@ -15,21 +15,28 @@ name: Python Release
1515on :
1616 release :
1717 types :
18- - released
19- - prereleased
18+ - published
2019 pull_request :
2120 paths :
2221 - .github/workflows/python-release.yml
2322 workflow_dispatch :
2423 inputs :
2524 mode :
26- description : " dry_run: build & test only, release: build & publish to PyPI "
25+ description : " dry_run: build & test only, release: build & publish"
2726 required : true
2827 default : " dry_run"
2928 type : choice
3029 options :
3130 - dry_run
3231 - release
32+ repo :
33+ description : " Target repository for publishing"
34+ required : true
35+ default : " fury"
36+ type : choice
37+ options :
38+ - fury
39+ - pypi
3340 ref :
3441 description : ' The branch, tag or SHA to checkout'
3542 required : false
@@ -71,29 +78,36 @@ jobs:
7178 - name : Determine release type
7279 id : release_type
7380 run : |
74- # Check if this is a beta/rc release based on the tag
75- TAG="${{ github.event.release.tag_name }}"
76- if [[ "$TAG" == *-beta.* ]] || [[ "$TAG" == *-rc.* ]]; then
77- echo "repo=fury" >> $GITHUB_OUTPUT
78- echo "Release type: beta/rc -> fury.io"
81+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
82+ # Use the input for manual workflow dispatch
83+ echo "repo=${{ inputs.repo }}" >> $GITHUB_OUTPUT
84+ echo "Release type (manual): ${{ inputs.repo }}"
7985 else
80- echo "repo=pypi" >> $GITHUB_OUTPUT
81- echo "Release type: stable -> PyPI"
86+ # For release events, check the tag
87+ TAG="${{ github.event.release.tag_name }}"
88+ if [[ "$TAG" == *-beta.* ]] || [[ "$TAG" == *-rc.* ]]; then
89+ echo "repo=fury" >> $GITHUB_OUTPUT
90+ echo "Release type: beta/rc -> fury.io"
91+ else
92+ echo "repo=pypi" >> $GITHUB_OUTPUT
93+ echo "Release type: stable -> PyPI"
94+ fi
8295 fi
8396
8497 - name : Publish to PyPI
8598 if : |
8699 steps.release_type.outputs.repo == 'pypi' &&
87- (( github.event_name == 'release' && github.event.action == 'released') ||
88- (github.event_name == 'workflow_dispatch' && github.event. inputs.mode == 'release'))
100+ (github.event_name == 'release' ||
101+ (github.event_name == 'workflow_dispatch' && inputs.mode == 'release'))
89102 run : |
90103 uv publish --trusted-publishing always
91104 echo "✅ Successfully published version ${{ steps.get_version.outputs.version }} to PyPI!"
92105
93106 - name : Publish to Fury (beta/rc)
94107 if : |
95108 steps.release_type.outputs.repo == 'fury' &&
96- github.event_name == 'release' && github.event.action == 'prereleased'
109+ (github.event_name == 'release' ||
110+ (github.event_name == 'workflow_dispatch' && inputs.mode == 'release'))
97111 env :
98112 FURY_TOKEN : ${{ secrets.FURY_TOKEN }}
99113 run : |
0 commit comments