|
1 | | -name: Build |
| 1 | +name: Build and upload to PyPI |
2 | 2 |
|
3 | | -# on: [push, pull_request] |
4 | 3 | on: |
5 | 4 | push: |
6 | 5 | paths-ignore: |
7 | 6 | - .gitignore |
8 | 7 | - README.md |
9 | 8 | - LICENSE |
10 | 9 | - doc/ |
| 10 | + release: |
| 11 | + types: |
| 12 | + - published |
11 | 13 |
|
12 | 14 | jobs: |
13 | 15 | build_wheels: |
14 | 16 | name: Build wheels on ${{ matrix.os }} |
15 | 17 | runs-on: ${{ matrix.os }} |
16 | 18 | strategy: |
| 19 | + # macos-13 is an intel runner, macos-14 is apple silicon |
17 | 20 | matrix: |
18 | | - os: [ubuntu-latest, windows-latest] |
| 21 | + os: [ubuntu-latest, windows-latest, macos-13, macos-latest] |
19 | 22 |
|
20 | 23 | steps: |
21 | 24 | - uses: actions/checkout@v4 |
22 | 25 |
|
23 | | - |
| 26 | + - name: Build wheels |
| 27 | + |
| 28 | + env: |
| 29 | + CIBW_BUILD_VERBOSITY: 1 |
24 | 30 |
|
25 | 31 | - uses: actions/upload-artifact@v4 |
26 | 32 | with: |
27 | 33 | name: rehline-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
28 | 34 | path: ./wheelhouse/*.whl |
| 35 | + |
| 36 | + build_sdist: |
| 37 | + name: Build source distribution |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Build sdist |
| 43 | + run: pipx run build --sdist |
| 44 | + |
| 45 | + - uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: rehline-sdist |
| 48 | + path: dist/*.tar.gz |
| 49 | + |
| 50 | + upload_pypi: |
| 51 | + needs: [build_wheels, build_sdist] |
| 52 | + runs-on: ubuntu-latest |
| 53 | + environment: pypi |
| 54 | + permissions: |
| 55 | + id-token: write |
| 56 | + if: github.event_name == 'release' && github.event.action == 'published' |
| 57 | + # or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) |
| 58 | + # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 59 | + steps: |
| 60 | + - uses: actions/download-artifact@v4 |
| 61 | + with: |
| 62 | + # unpacks all regot artifacts into dist/ |
| 63 | + pattern: rehline-* |
| 64 | + path: dist |
| 65 | + merge-multiple: true |
| 66 | + |
| 67 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 68 | + # with: |
| 69 | + # To test: repository-url: https://test.pypi.org/legacy/ |
0 commit comments