File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and upload to PyPI
2+
3+ # Build on every branch push, tag push, and pull request change:
4+ # on: [push, pull_request]
5+ # Alternatively, to publish when a (published) GitHub Release is created, use the following:
6+ on :
7+ push :
8+ pull_request :
9+ release :
10+ types :
11+ - published
12+
13+ jobs :
14+ build_and_upload_pypi :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
18+ # upload to PyPI on every tag starting with 'v'
19+ # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
20+ # alternatively, to publish when a GitHub Release is created, use the following rule:
21+ if : github.event_name == 'release' && github.event.action == 'published'
22+ steps :
23+ - name : checkout repository
24+ uses : actions/checkout@v5
25+
26+ - name : Set up Python
27+ uses : actions/setup-python@v6
28+ id : cp
29+ with :
30+ python-version : " 3.12"
31+ update-environment : true
32+
33+ - name : Install pypa/build
34+ run : |
35+ python -m pip install build
36+
37+ - name : Build a binary wheel and a source tarball
38+ run : |
39+ python -m build .
40+
41+ - name : Upload to PyPI
42+ uses : pypa/gh-action-pypi-publish@release/v1
43+ # with:
44+ # user: __token__
45+ # password: ${{ secrets.pypi_password }}
46+ # To test: repository_url: https://test.pypi.org/legacy/
You can’t perform that action at this time.
0 commit comments