|
1 | | -name: Build wheels and tar |
| 1 | +name: Build wheels and sdist |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | pull_request: |
5 | 5 | types: [opened, synchronize] |
6 | 6 | push: |
7 | 7 | tags: |
8 | 8 | - '*' |
| 9 | + workflow_dispatch: |
9 | 10 |
|
10 | 11 | jobs: |
| 12 | + |
| 13 | + sdists_for_pypi: |
| 14 | + name: Build sdist (and upload to PyPI on release tags) |
| 15 | + runs-on: ubuntu-latest |
| 16 | + env: |
| 17 | + CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }} |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - uses: actions/setup-python@v4 |
| 21 | + - name: make sdist |
| 22 | + run: | |
| 23 | + pipx run build -s |
| 24 | + - uses: actions/upload-artifact@v3 |
| 25 | + with: |
| 26 | + path: "dist/*.tar.gz" |
| 27 | + name: dist |
| 28 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 29 | + with: |
| 30 | + user: __token__ |
| 31 | + password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }} |
| 32 | + skip_existing: true |
| 33 | + verbose: true |
| 34 | + if: env.CAN_DEPLOY == 'true' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 35 | + |
11 | 36 | build_wheels: |
12 | | - name: Wheels on ${{ matrix.os }} |
| 37 | + name: Build wheels on ${{ matrix.os }} |
13 | 38 | runs-on: ${{ matrix.os }} |
14 | 39 | strategy: |
15 | 40 | matrix: |
16 | | - os: [ubuntu-latest, macos-latest, windows-latest] |
| 41 | + os: [ubuntu-latest, macOS-latest, macOS-14] |
| 42 | + |
17 | 43 | steps: |
18 | | - - uses: actions/checkout@v2 |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + |
| 46 | + # Used to host cibuildwheel |
| 47 | + - uses: actions/setup-python@v4 |
19 | 48 |
|
20 | 49 | - name: Build wheels |
21 | | - |
22 | | - # to supply options, put them in 'env', like: |
23 | | - # env: |
24 | | - # CIBW_SOME_OPTION: value |
| 50 | + |
25 | 51 |
|
26 | | - - uses: actions/upload-artifact@v2 |
| 52 | + - uses: actions/upload-artifact@v3 |
27 | 53 | with: |
| 54 | + name: wheels |
28 | 55 | path: ./wheelhouse/*.whl |
29 | 56 |
|
30 | | - build_sdist: |
31 | | - name: Build source distribution |
32 | | - runs-on: ubuntu-latest |
33 | | - steps: |
34 | | - - uses: actions/checkout@v2 |
35 | | - - uses: actions/setup-python@v2 |
36 | | - name: Install Python |
37 | | - with: |
38 | | - python-version: '3.8' |
| 57 | + pypi-publish: |
| 58 | + # https://github.com/pypa/gh-action-pypi-publish |
| 59 | + name: Upload wheels to PyPI |
| 60 | + needs: build_wheels |
| 61 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 62 | + runs-on: ubuntu-latest |
| 63 | + env: |
| 64 | + CAN_DEPLOY: ${{ secrets.SAGEMATH_PYPI_API_TOKEN != '' }} |
| 65 | + steps: |
39 | 66 |
|
40 | | - - name: Build sdist |
41 | | - run: python setup.py sdist |
| 67 | + - uses: actions/download-artifact@v3 |
| 68 | + with: |
| 69 | + name: wheels |
| 70 | + path: wheelhouse |
42 | 71 |
|
43 | | - - uses: actions/upload-artifact@v2 |
| 72 | + - name: Publish package distributions to PyPI |
| 73 | + uses: pypa/gh-action-pypi-publish@release/v1 |
44 | 74 | with: |
45 | | - path: dist/*.tar.gz |
| 75 | + user: __token__ |
| 76 | + password: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }} |
| 77 | + packages_dir: wheelhouse/ |
| 78 | + skip_existing: true |
| 79 | + verbose: true |
| 80 | + if: env.CAN_DEPLOY == 'true' |
0 commit comments