File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,8 +2,11 @@ name: Build Package
22
33on :
44 push :
5+ branches : [main]
56 tags :
67 - ' v*'
8+ pull_request :
9+ branches : [main]
710 workflow_dispatch :
811
912jobs :
3437 - name : Upload artifacts
3538 uses : actions/upload-artifact@v4
3639 with :
37- name : dist
40+ name : python-package-distributions
3841 path : dist/
3942
40- - name : Publish to PyPI (on tag)
41- if : startsWith(github.ref, 'refs/tags/v')
42- env :
43- TWINE_USERNAME : __token__
44- TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
45- run : |
46- python -m twine upload dist/*
47-
Original file line number Diff line number Diff line change 1+ name : Publish to PyPI
2+
3+ on :
4+ release :
5+ types : [published]
6+ workflow_dispatch :
7+ inputs :
8+ version :
9+ description : ' Version tag (e.g., v0.1.0)'
10+ required : true
11+ type : string
12+
13+ jobs :
14+ publish-pypi :
15+ runs-on : ubuntu-latest
16+ environment :
17+ name : pypi
18+ url : https://pypi.org/p/lab-testing
19+ permissions :
20+ id-token : write # IMPORTANT: this permission is needed for trusted publishing
21+
22+ steps :
23+ - name : Download all dists
24+ uses : actions/download-artifact@v4
25+ with :
26+ name : python-package-distributions
27+ path : dist/
28+ github-token : ${{ secrets.GITHUB_TOKEN }}
29+
30+ - name : Publish package to PyPI
31+ uses : pypa/gh-action-pypi-publish@release/v1
32+
You can’t perform that action at this time.
0 commit comments