File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Test
22
3- on : [push, pull_request]
3+ on :
4+ pull_request :
5+ push :
6+ branches : ["**"]
7+ workflow_dispatch :
8+ inputs :
9+ publish_to :
10+ description : Where to publish
11+ type : choice
12+ required : true
13+ default : none
14+ options :
15+ - none
16+ - testpypi
17+ - pypi
418
519jobs :
6- build-and- test :
20+ test :
721 # We want to run on external PRs, but not on our own internal PRs as they'll be run
822 # by the push to the branch. Without this if check, checks are duplicated since
923 # internal PRs match both the push and pull_request events.
3953 uses : codecov/codecov-action@v6
4054 with :
4155 token : ${{ secrets.CODECOV_TOKEN }}
56+
57+ publish :
58+ needs : [test]
59+ runs-on : ubuntu-latest
60+ if : github.event_name == 'workflow_dispatch' && inputs.publish_to != 'none'
61+ env :
62+ REPOSITORY_URL : ${{ inputs.publish_to == 'testpypi' && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}
63+
64+ permissions :
65+ id-token : write
66+
67+ steps :
68+ - uses : actions/download-artifact@v8
69+ with :
70+ pattern : build-*
71+ merge-multiple : true
72+ path : ${{ github.workspace }}/dist
73+
74+ - name : Publish
75+ uses : pypa/gh-action-pypi-publish@release/v1
76+ with :
77+ repository-url : ${{ env.REPOSITORY_URL }}
78+ packages-dir : dist
79+ skip-existing : true
80+ print-hash : true
81+ verify-metadata : false
You can’t perform that action at this time.
0 commit comments