Skip to content

Commit ce23fdf

Browse files
authored
Update Python package upload workflow triggers and steps
1 parent 08c63f3 commit ce23fdf

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

.github/workflows/pythonpublish.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@ name: Upload Python Package
22

33
on:
44
release:
5-
types: [created]
5+
types: [published,created] # Triggers the workflow when a release is published
66

77
jobs:
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

0 commit comments

Comments
 (0)