|
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 |
2 | 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 | 3 |
|
4 | 4 | name: Upload Python Package |
|
8 | 8 | types: [created] |
9 | 9 |
|
10 | 10 | 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 |
15 | 14 | steps: |
16 | | - - uses: actions/checkout@v2 |
17 | | - - name: Set up Python |
| 15 | + - uses: actions/checkout@master |
| 16 | + - name: Set up Python 3.7 |
18 | 17 | uses: actions/setup-python@v1 |
19 | 18 | with: |
20 | | - python-version: '3.x' |
| 19 | + python-version: 3.x |
21 | 20 | - name: Install dependencies |
22 | 21 | run: | |
23 | 22 | 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 |
29 | 25 | run: | |
30 | 26 | 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