Skip to content

Commit a140c1d

Browse files
authored
Update pythonpublish.yml
1 parent 797b4fd commit a140c1d

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed
Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
1+
# This workflows will upload a Python Package using pypa/gh-action-pypi-publish@master when a release is created
22
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
33

44
name: Upload Python Package
@@ -8,24 +8,33 @@ on:
88
types: [created]
99

1010
jobs:
11-
deploy:
12-
13-
runs-on: ubuntu-latest
14-
11+
build-n-publish:
12+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
13+
runs-on: ubuntu-18.04
1514
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Python
15+
- uses: actions/checkout@master
16+
- name: Set up Python 3.7
1817
uses: actions/setup-python@v1
1918
with:
20-
python-version: '3.x'
19+
python-version: 3.x
2120
- name: Install dependencies
2221
run: |
2322
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
25-
- name: Build and publish
26-
env:
27-
TWINE_USERNAME: __token__
28-
TWINE_PASSWORD: ${{ secrets.pypi_password }}
23+
pip install setuptools wheel
24+
- name: Build a binary wheel and a source tarball
2925
run: |
3026
python setup.py sdist bdist_wheel
31-
twine upload dist/*
27+
- name: Publish distribution 📦 to Test PyPI
28+
uses: pypa/gh-action-pypi-publish@master
29+
with:
30+
user: __token__
31+
password: ${{ secrets.test_pypi_password }}
32+
repository_url: https://test.pypi.org/legacy/
33+
- name: Publish distribution 📦 to PyPI
34+
if: startsWith(github.event.ref, 'refs/tags')
35+
uses: pypa/gh-action-pypi-publish@master
36+
with:
37+
user: __token__
38+
password: ${{ secrets.pypi_password }}
39+
40+

0 commit comments

Comments
 (0)