Skip to content

Commit b9726a6

Browse files
committed
Update Python package workflow to use actions/setup-python@v5 and enhance publishing step
- Upgraded setup-python action to version 5. - Added environment declaration for PyPI publishing. - Replaced manual twine upload with pypa/gh-action-pypi-publish for streamlined distribution.
1 parent 528fed4 commit b9726a6

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v4
1616

1717
- name: Set up Python 3.12
18-
uses: actions/setup-python@v3
18+
uses: actions/setup-python@v5
1919
with:
2020
python-version: "3.12"
2121

@@ -34,15 +34,21 @@ jobs:
3434
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3535
3636
publish:
37+
name: Publish Python 🐍 distribution 📦 to PyPI
3738
if: startsWith(github.ref, 'refs/tags/v')
3839
needs: build
3940
runs-on: ubuntu-latest
41+
environment:
42+
name: pypi
43+
url: https://pypi.org/p/ifclca
44+
permissions:
45+
id-token: write # IMPORTANT: mandatory for trusted publishing
4046

4147
steps:
4248
- uses: actions/checkout@v4
4349

4450
- name: Set up Python 3.12
45-
uses: actions/setup-python@v3
51+
uses: actions/setup-python@v5
4652
with:
4753
python-version: "3.12"
4854

@@ -52,10 +58,6 @@ jobs:
5258
python -m pip install setuptools wheel
5359
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
5460
55-
- name: Install wheel & twine
56-
run: |
57-
python -m pip install wheel twine
58-
5961
- name: Extract and validate version from tag
6062
id: get_version
6163
run: |
@@ -82,9 +84,7 @@ jobs:
8284
run: |
8385
python setup.py sdist bdist_wheel
8486
85-
- name: Publish to PyPI
86-
run: |
87-
twine upload --skip-existing dist/*
88-
env:
89-
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
90-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
87+
- name: Publish distribution 📦 to PyPI
88+
uses: pypa/gh-action-pypi-publish@release/v1
89+
with:
90+
skip-existing: true

0 commit comments

Comments
 (0)