Skip to content

Commit ffe52dc

Browse files
committed
Use pypa/gh-action-pypi-publish Github action to publish releases to PyPI
1 parent 3cbeb48 commit ffe52dc

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

.github/workflows/dev-release.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
${{ runner.os }}-
7575
7676
- name: Upgrade pip
77-
run: python -m pip install --upgrade pip setuptools wheel twine
77+
run: python -m pip install --upgrade pip setuptools wheel
7878

7979
- name: Install dependencies
8080
run: pip install -r requirements.txt
@@ -89,12 +89,8 @@ jobs:
8989
- name: Build package
9090
run: python setup.py sdist bdist_wheel
9191

92-
- name: Check package
93-
run: twine check dist/*
94-
9592
- name: Publish package
96-
env:
97-
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
98-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
99-
run: |
100-
twine upload --repository testpypi dist/*
93+
uses: pypa/gh-action-pypi-publish@release/v1
94+
with:
95+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
96+
repository_url: https://test.pypi.org/legacy/

.github/workflows/release.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
${{ runner.os }}-
7373
7474
- name: Upgrade pip
75-
run: python -m pip install --upgrade pip setuptools wheel twine
75+
run: python -m pip install --upgrade pip setuptools wheel
7676

7777
- name: Install dependencies
7878
run: pip install -r requirements.txt -r requirements-doc.txt
@@ -97,15 +97,10 @@ jobs:
9797
# lines 1 and 3 are empty, line 2 contains version number, line 4 contains release date
9898
changelog generate-md -c ./docs/conf.py CHANGELOG.rst -v $version | sed "1,4d" > reports/release.md
9999
100-
- name: Check package
101-
run: twine check dist/*
102-
103100
- name: Publish package
104-
env:
105-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
106-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
107-
run: |
108-
twine upload dist/*
101+
uses: pypa/gh-action-pypi-publish@release/v1
102+
with:
103+
password: ${{ secrets.PYPI_API_TOKEN }}
109104

110105
- name: Create Github release
111106
id: create_release

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Changelog
88
:version: 1.13.1
99
:released: 13.11.2022
1010

11+
.. change::
12+
:tags: ci, feature
13+
:tickets: 72, 49
14+
15+
Use ``pypa/gh-action-pypi-publish`` Github action to publish releases to PyPI
16+
1117
.. change::
1218
:tags: general, feature
1319
:tickets: 72, 49

0 commit comments

Comments
 (0)