|
1 | 1 | name: Upload to PyPI |
| 2 | + |
2 | 3 | on: |
3 | 4 | release: |
4 | 5 | types: [published] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + debug_enabled: |
| 9 | + type: boolean |
| 10 | + description: Debug with tmate |
| 11 | + required: false |
| 12 | + default: false |
| 13 | + |
5 | 14 | jobs: |
6 | 15 | upload: |
7 | 16 | runs-on: ubuntu-latest |
| 17 | + |
8 | 18 | steps: |
9 | | - - uses: actions/checkout@v2 |
10 | | - - name: Fetch complete history for all tags and branches |
11 | | - run: git fetch --prune --unshallow |
12 | | - - name: Set up Python |
13 | | - uses: actions/setup-python@v2 |
14 | | - with: |
15 | | - python-version: '3.x' |
16 | | - - name: Install dependencies |
17 | | - run: | |
18 | | - python -m pip install --upgrade pip |
19 | | - pip install setuptools wheel twine setuptools-scm[toml] |
20 | | - - name: Build distribution |
21 | | - run: python setup.py sdist bdist_wheel |
22 | | - - name: Publish to PyPI Test |
23 | | - env: |
24 | | - TWINE_USERNAME: __token__ |
25 | | - TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }} |
26 | | - run: twine upload --repository testpypi dist/* |
27 | | - - name: Publish to PyPI |
28 | | - env: |
29 | | - TWINE_USERNAME: __token__ |
30 | | - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
31 | | - run: twine upload --repository pypi dist/* |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Fetch all tags and branches |
| 23 | + run: git fetch --prune --unshallow |
| 24 | + |
| 25 | + - name: Set up Python |
| 26 | + uses: actions/setup-python@v4 |
| 27 | + with: |
| 28 | + python-version: "3.10" |
| 29 | + |
| 30 | + - name: Debug with tmate |
| 31 | + uses: mxschmitt/action-tmate@v3 |
| 32 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + python -m pip install --upgrade pip |
| 37 | + pip install setuptools wheel twine setuptools-scm[toml] |
| 38 | +
|
| 39 | + - name: Build distribution |
| 40 | + run: python setup.py sdist bdist_wheel |
| 41 | + |
| 42 | + - name: Publish to PyPI Test |
| 43 | + env: |
| 44 | + TWINE_USERNAME: __token__ |
| 45 | + TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }} |
| 46 | + run: twine upload --repository testpypi dist/* |
| 47 | + |
| 48 | + - name: Publish to PyPI |
| 49 | + env: |
| 50 | + TWINE_USERNAME: __token__ |
| 51 | + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 52 | + run: twine upload --repository pypi dist/* |
0 commit comments