Skip to content

Commit a0a4c12

Browse files
authored
Update Python publish workflow for GitHub Actions
1 parent dede5b5 commit a0a4c12

1 file changed

Lines changed: 27 additions & 16 deletions

File tree

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# This workflows will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
14
name: Upload Python Package
25

36
on:
@@ -6,22 +9,30 @@ on:
69

710
jobs:
811
deploy:
9-
1012
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
1115

1216
steps:
13-
- uses: actions/checkout@v2
14-
- name: Set up Python
15-
uses: actions/setup-python@v1
16-
with:
17-
python-version: '3.x'
18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install setuptools wheel twine
22-
python setup.py sdist bdist_wheel
23-
- name: Publish a Python distribution to PyPI
24-
uses: pypa/gh-action-pypi-publish@release/v1
25-
with:
26-
user: __token__
27-
password: ${{ secrets.PYPI_API_TOKEN }}
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.x'
23+
cache: 'pip'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install setuptools wheel twine
29+
30+
- name: Build package
31+
run: |
32+
python setup.py sdist bdist_wheel
33+
34+
- name: Publish a Python distribution to PyPI
35+
uses: pypa/gh-action-pypi-publish@release/v1
36+
with:
37+
user: __token__
38+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)