|
1 | 1 | # This GitHub workflow is only needed for python package releases which are supposed to be published on pypi. |
2 | | - |
3 | | - |
4 | | -# This workflows will upload a Python Package using Twine when a release is created |
| 2 | +# This workflow will upload a Python Package using Twine when a release is created |
5 | 3 | # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries |
6 | 4 |
|
7 | | -# name: Upload Python Package |
| 5 | +name: Upload Python Package |
8 | 6 |
|
9 | | -# on: |
10 | | -# release: |
11 | | -# branches: main |
12 | | -# types: [created, edited] |
| 7 | +on: |
| 8 | + release: |
| 9 | + types: [ created, edited ] |
13 | 10 |
|
14 | | -# jobs: |
15 | | -# tests: |
16 | | -# if: startsWith(github.ref, 'refs/tags/v') |
17 | | -# runs-on: ${{ matrix.os }} |
18 | | -# strategy: |
19 | | -# matrix: |
20 | | -# python-version: ["3.11"] |
21 | | -# os: [ubuntu-latest] |
22 | | -# steps: |
23 | | -# - uses: actions/checkout@v2 |
24 | | -# - name: Set up Python ${{ matrix.python-version }} |
25 | | -# uses: actions/setup-python@v2 |
26 | | -# with: |
27 | | -# python-version: ${{ matrix.python-version }} |
28 | | -# - name: Install tox |
29 | | -# run: | |
30 | | -# python -m pip install --upgrade pip |
31 | | -# pip install tox |
32 | | -# - name: Run tox |
33 | | -# run: | |
34 | | -# tox |
| 11 | +jobs: |
| 12 | + tests: |
| 13 | + if: startsWith(github.ref, 'refs/tags/v') |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + python-version: [ "3.11" ] |
| 18 | + os: [ ubuntu-latest ] |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + - name: Set up Python ${{ matrix.python-version }} |
| 22 | + uses: actions/setup-python@v2 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + - name: Install tox |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade pip |
| 28 | + pip install tox |
| 29 | + - name: Run tox |
| 30 | + run: | |
| 31 | + tox |
35 | 32 |
|
36 | | -# build-n-publish: |
37 | | -# name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI |
38 | | -# runs-on: ubuntu-latest |
39 | | -# needs: tests |
40 | | -# steps: |
41 | | -# - uses: actions/checkout@v2 |
42 | | -# - name: Set up Python |
43 | | -# uses: actions/setup-python@v2 |
44 | | -# with: |
45 | | -# python-version: ${{ matrix.python-version }} |
46 | | -# - name: Install dependencies |
47 | | -# run: | |
48 | | -# python -m pip install --upgrade pip |
49 | | -# pip install setuptools setuptools-scm wheel twine |
50 | | -# - name: Build a binary wheel and a source tarball |
51 | | -# run: | |
52 | | -# python setup.py sdist bdist_wheel |
53 | | -# - name: Publish distribution 📦 to PyPI |
54 | | -# if: startsWith(github.ref, 'refs/tags/v') |
55 | | -# uses: pypa/gh-action-pypi-publish@release/v1 |
56 | | -# with: |
57 | | -# user: __token__ |
58 | | -# password: ${{ secrets.PYPI_API_TOKEN }} |
| 33 | + build-n-publish: |
| 34 | + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI |
| 35 | + runs-on: ubuntu-latest |
| 36 | + needs: tests |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v2 |
| 39 | + - name: Set up Python |
| 40 | + uses: actions/setup-python@v2 |
| 41 | + with: |
| 42 | + python-version: ${{ matrix.python-version }} |
| 43 | + - name: Install dependencies |
| 44 | + run: | |
| 45 | + python -m pip install --upgrade pip |
| 46 | + pip install -r dev_requirements/requirements-packaging.txt |
| 47 | + - name: Build a binary wheel and a source tarball |
| 48 | + run: | |
| 49 | + python -m build |
| 50 | + - name: Publish distribution 📦 to PyPI |
| 51 | + if: startsWith(github.ref, 'refs/tags/v') |
| 52 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 53 | + with: |
| 54 | + user: __token__ |
| 55 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments