|
1 | 1 | name: Publish to PyPi |
2 | 2 |
|
| 3 | + |
3 | 4 | on: |
4 | 5 | workflow_dispatch: |
5 | | - release: |
6 | | - types: [created] |
| 6 | + push: |
| 7 | + branches: development, main |
7 | 8 |
|
8 | 9 | jobs: |
9 | | - |
10 | | - build: |
11 | | - runs-on: ubuntu-latest |
12 | | - strategy: |
13 | | - matrix: |
14 | | - python-version: [3.9] |
15 | | - 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 sdist |
29 | | - python setup.py bdist_wheel |
30 | | - |
31 | | -
|
32 | | - test-deploy: |
33 | | - if: github.ref_type == 'tag' && contains(github.ref_name, 'test') |
34 | | - needs: build |
35 | | - environment: |
36 | | - name: test-pypi |
| 10 | + build-n-publish: |
| 11 | + name: Build dist files for PyPi |
37 | 12 | runs-on: ubuntu-latest |
38 | 13 | steps: |
39 | | - - name: Publish 📦 to Test PyPI |
40 | | - uses: pypa/gh-action-pypi-publish@master |
41 | | - with: |
42 | | - password: ${{ secrets.TEST_PYPI_TOKEN }} |
43 | | - repository_url: https://test.pypi.org/legacy/ |
44 | | - |
| 14 | + - uses: actions/checkout@v3 |
| 15 | + with: |
| 16 | + fetch-depth: 0 |
| 17 | + - uses: actions/setup-python@v1 |
| 18 | + with: |
| 19 | + python-version: 3.8 |
| 20 | + - name: Build dist files |
| 21 | + run: > |
| 22 | + python -m pip install --upgrade pip && pip install -e .[build] && |
| 23 | + python setup.py build && |
| 24 | + python setup.py sdist --formats=gztar |
| 25 | + - name: Publish distribution 📦 to Test PyPI |
| 26 | + uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2 |
| 27 | + with: |
| 28 | + password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 29 | + repository_url: https://test.pypi.org/legacy/ |
| 30 | + - name: Publish distribution 📦 to PyPI |
| 31 | + uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2 |
| 32 | + with: |
| 33 | + password: ${{ secrets.PYPI_API_TOKEN }} |
45 | 34 |
|
46 | | - production-deploy: |
47 | | - needs: build |
48 | | - environment: |
49 | | - name: pypi |
50 | | - runs-on: ubuntu-latest |
51 | | - steps: |
52 | | - - name: Publish 📦 to Real PyPI |
53 | | - uses: pypa/gh-action-pypi-publish@master |
54 | | - with: |
55 | | - password: ${{ secrets.PYPI_API_TOKEN }} |
56 | | - repository_url: https://pypi.org/legacy/ |
0 commit comments