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,25 +2,27 @@ name: Upload Python Package
22
33on :
44 release :
5- types : [created]
5+ types : [published, created] # Triggers the workflow when a release is published
66
77jobs :
8- deploy :
8+ build-and-publish :
99 runs-on : ubuntu-latest
10+ environment :
11+ name : pypi # Must match the environment name configured on PyPI (if used)
1012 permissions :
11- id-token : write # Mandatory for trusted publishing
1213 contents : read
14+ id-token : write # Mandatory for OIDC trusted publishing
15+
1316 steps :
1417 - uses : actions/checkout@v4
1518 - name : Set up Python
1619 uses : actions/setup-python@v5
1720 with :
18- python-version : ' 3.x'
21+ python-version : " 3.x"
1922 - name : Install dependencies
20- run : |
21- python -m pip install --upgrade pip
22- pip install setuptools wheel twine
23- - name : Build and publish
24- run : |
25- python setup.py clean sdist bdist_wheel
26- twine upload dist/*
23+ run : python -m pip install --upgrade pip build
24+ - name : Build package
25+ run : python -m build
26+ - name : Publish package distributions to PyPI
27+ uses : pypa/gh-action-pypi-publish@release/v1
28+ # No username or password needed; OIDC handles authentication
You can’t perform that action at this time.
0 commit comments