|
1 |
| -name: PyPi Release |
| 1 | +name: Publish to PyPI |
2 | 2 |
|
3 |
| -# https://help.github.com/en/actions/reference/events-that-trigger-workflows |
4 | 3 | on:
|
5 |
| - # Trigger the workflow on push or pull request, |
6 |
| - # but only for the master branch |
7 | 4 | push:
|
8 | 5 | branches:
|
9 | 6 | - master
|
10 | 7 | release:
|
11 | 8 | types:
|
12 | 9 | - created
|
13 | 10 |
|
14 |
| -# based on https://github.com/pypa/gh-action-pypi-publish |
15 |
| - |
16 | 11 | jobs:
|
17 |
| - build: |
| 12 | + publish: |
18 | 13 | runs-on: ubuntu-latest
|
19 |
| - strategy: |
20 |
| - matrix: |
21 |
| - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
22 | 14 |
|
23 | 15 | steps:
|
24 |
| - - uses: actions/checkout@v2 |
25 |
| - - uses: actions/setup-python@v2 |
| 16 | + - name: Check out the code |
| 17 | + uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - name: Set up Python |
| 20 | + uses: actions/setup-python@v2 |
26 | 21 | with:
|
27 |
| - python-version: ${{ matrix.python-version }} |
| 22 | + python-version: "3.x" # Use the latest Python version for publishing |
28 | 23 |
|
29 | 24 | - name: Install dependencies
|
30 |
| - run: >- |
31 |
| - python -m pip install --upgrade setuptools wheel twine |
| 25 | + run: | |
| 26 | + python -m pip install --upgrade pip setuptools wheel twine |
32 | 27 |
|
33 |
| - - name: Build |
34 |
| - run: >- |
| 28 | + - name: Build the package |
| 29 | + run: | |
35 | 30 | python setup.py sdist bdist_wheel
|
36 | 31 |
|
37 |
| - # We do this, since failures on test.pypi aren't that bad |
| 32 | + - name: Check the package |
| 33 | + run: | |
| 34 | + twine check dist/* |
| 35 | +
|
38 | 36 | - name: Publish to Test PyPI
|
39 | 37 | if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
40 | 38 | uses: pypa/gh-action-pypi-publish@release/v1
|
|
43 | 41 | password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
44 | 42 | repository-url: https://test.pypi.org/legacy/
|
45 | 43 |
|
46 |
| - - name: Publish distribution 📦 to PyPI |
| 44 | + - name: Publish to PyPI |
47 | 45 | if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
48 | 46 | uses: pypa/gh-action-pypi-publish@release/v1
|
49 | 47 | with:
|
|
0 commit comments