11name : Publish pywry to PyPI
22
33on :
4- release :
5- types : [published]
64 workflow_dispatch :
75 inputs :
86 skip_tests :
97 description : ' Skip running tests (use with caution)'
108 required : false
119 default : false
1210 type : boolean
11+ publish_to_pypi :
12+ description : ' Publish wheels to PyPI after build + test'
13+ required : false
14+ default : false
15+ type : boolean
1316
1417concurrency :
1518 group : ${{ github.workflow }}-${{ github.ref }}
@@ -433,14 +436,14 @@ jobs:
433436
434437 steps :
435438 - name : Download all wheel artifacts
436- uses : actions/download-artifact@v5
439+ uses : actions/download-artifact@v8.0.1
437440 with :
438441 pattern : wheels-*
439442 merge-multiple : true
440443 path : dist/
441444
442445 - name : Download sdist
443- uses : actions/download-artifact@v5
446+ uses : actions/download-artifact@v8.0.1
444447 with :
445448 name : sdist
446449 path : dist/
@@ -649,15 +652,6 @@ jobs:
649652 contents : write
650653
651654 steps :
652- - name : Download dist artifacts
653- uses : actions/download-artifact@v5
654- with :
655- name : dist
656- path : dist/
657-
658- - name : List artifacts
659- run : ls -la dist/
660-
661655 - name : Create draft release
662656 uses : softprops/action-gh-release@v2
663657 with :
@@ -666,8 +660,6 @@ jobs:
666660 draft : true
667661 prerelease : false
668662 generate_release_notes : true
669- files : |
670- dist/*
671663 body : |
672664 ## pywry ${{ needs.merge-artifacts.outputs.version }}
673665
@@ -692,19 +684,20 @@ jobs:
692684
693685 - Python 3.10, 3.11, 3.12, 3.13, 3.14
694686
695- ### Artifacts
696-
697- All artifacts include SLSA build provenance attestations.
698-
699687 ---
700- *This is a draft release. Review and publish to trigger PyPI upload .*
688+ *This is a draft release. Wheels are published to PyPI separately .*
701689
702690 # =============================================================================
703- # Step 6: Publish to PyPI (on release publish) - Trusted Publisher
691+ # Step 6: Publish to PyPI - Trusted Publisher (workflow_dispatch only)
704692 # =============================================================================
705693 publish-pypi :
706694 name : Publish to PyPI
707- if : github.event_name == 'release' && github.event.action == 'published'
695+ needs : [merge-artifacts, test-wheels]
696+ if : >-
697+ always()
698+ && needs.merge-artifacts.result == 'success'
699+ && (needs.test-wheels.result == 'success' || needs.test-wheels.result == 'skipped')
700+ && inputs.publish_to_pypi
708701 runs-on : ubuntu-24.04
709702 defaults :
710703 run :
@@ -713,19 +706,14 @@ jobs:
713706 id-token : write
714707
715708 steps :
716- - name : Download release assets
717- env :
718- GH_TOKEN : ${{ github.token }}
719- run : |
720- mkdir -p dist
721- gh release download ${{ github.event.release.tag_name }} --dir dist --repo ${{ github.repository }}
709+ - name : Download dist artifacts
710+ uses : actions/download-artifact@v5
711+ with :
712+ name : dist
713+ path : dist/
722714
723- - name : Filter only distribution files
715+ - name : List distribution files
724716 run : |
725- mkdir -p clean_dist
726- mv dist/*.whl dist/*.tar.gz clean_dist/ 2>/dev/null || true
727- rm -rf dist
728- mv clean_dist dist
729717 echo "📦 Publishing to PyPI:"
730718 ls -la dist/
731719
0 commit comments