|
1 | 1 | name: Publish to PyPi
|
2 | 2 |
|
| 3 | + |
3 | 4 | on:
|
4 | 5 | workflow_dispatch:
|
5 |
| - release: |
6 |
| - types: [created] |
| 6 | + inputs: |
| 7 | + is_draft: |
| 8 | + description: 'Test PyPi' |
| 9 | + required: true |
| 10 | + type: boolean |
| 11 | + push: |
| 12 | + branches: development, main |
7 | 13 |
|
8 | 14 | jobs:
|
9 |
| - |
10 |
| - build-then-publish: |
| 15 | + build-n-publish: |
| 16 | + name: Build dist files for PyPi |
11 | 17 | runs-on: ubuntu-latest
|
12 |
| - strategy: |
13 |
| - matrix: |
14 |
| - python-version: [3.9] |
15 | 18 | steps:
|
16 |
| - - uses: actions/checkout@v2 |
17 |
| - - name: Set up Python ${{ matrix.python-version }} |
18 |
| - uses: actions/setup-python@v2 |
19 |
| - with: |
20 |
| - python-version: ${{ matrix.python-version }} |
21 |
| - - name: Install dependencies |
22 |
| - run: | |
23 |
| - python -m pip install --upgrade pip |
24 |
| - pip install wheel |
25 |
| - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
26 |
| - - name: Package |
27 |
| - run: | |
28 |
| - python setup.py build |
29 |
| - python setup.py sdist |
30 |
| - python setup.py bdist_wheel |
31 |
| - - name: Publish distribution 📦 to Test PyPI |
32 |
| - if: github.ref_type == 'tag' && contains(github.ref_name, 'test') |
33 |
| - uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2 |
34 |
| - with: |
35 |
| - password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
36 |
| - repository_url: https://test.pypi.org/legacy/ |
37 |
| - - name: Publish distribution 📦 to PyPI |
38 |
| - if: ${{ github.ref == 'refs/heads/master' && inputs.is_draft }} |
39 |
| - - uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2 |
40 |
| - with: |
41 |
| - password: ${{ secrets.PYPI_API_TOKEN }} |
42 |
| - |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + - uses: actions/setup-python@v1 |
| 23 | + with: |
| 24 | + python-version: 3.8 |
| 25 | + - name: Build dist files |
| 26 | + run: > |
| 27 | + python -m pip install --upgrade pip && pip install -e .[test] && |
| 28 | + python setup.py build && python res/versioning && python setup.py build && |
| 29 | + python setup.py sdist --formats=gztar |
| 30 | + - name: Publish distribution 📦 to Test PyPI |
| 31 | + uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2 |
| 32 | + with: |
| 33 | + password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 34 | + repository_url: https://test.pypi.org/legacy/ |
| 35 | + - name: Publish distribution 📦 to PyPI |
| 36 | + uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2 |
| 37 | + with: |
| 38 | + password: ${{ secrets.PYPI_API_TOKEN }} |
43 | 39 |
|
44 |
| - |
0 commit comments