|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v* |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-wheels: |
| 10 | + name: Build wheels for ${{ matrix.os }} |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ubuntu-latest, macos-13, macos-14] |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - uses: actions/setup-python@v3 |
| 20 | + |
| 21 | + - name: Install cibuildwheel |
| 22 | + run: python -m pip install cibuildwheel==2.16.5 |
| 23 | + |
| 24 | + - name: Build wheels |
| 25 | + run: python -m cibuildwheel --output-dir wheelhouse |
| 26 | + env: |
| 27 | + CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7" |
| 28 | + |
| 29 | + - uses: actions/upload-artifact@v4 |
| 30 | + with: |
| 31 | + name: dist-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 32 | + path: ./wheelhouse/*.whl |
| 33 | + |
| 34 | + build-sdist: |
| 35 | + name: Build source distribution |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Build sdist |
| 41 | + run: pipx run build --sdist |
| 42 | + |
| 43 | + - uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: dist-sdist |
| 46 | + path: dist/*.tar.gz |
| 47 | + |
| 48 | + publish-to-pypi: |
| 49 | + name: Publish to PyPI |
| 50 | + runs-on: ubuntu-latest |
| 51 | + needs: [build-wheels, build-sdist] |
| 52 | + environment: |
| 53 | + name: pypi |
| 54 | + url: https://pypi.org/p/xsuite-kernels |
| 55 | + permissions: |
| 56 | + id-token: write |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Check tag is a public release |
| 60 | + id: check-tag |
| 61 | + run: | |
| 62 | + if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 63 | + echo "match=true" >> $GITHUB_OUTPUT |
| 64 | + fi |
| 65 | +
|
| 66 | + - name: Download all the dists |
| 67 | + if: steps.check-tag.outputs.match == 'true' |
| 68 | + uses: actions/download-artifact@v4 |
| 69 | + with: |
| 70 | + pattern: dist-* |
| 71 | + path: dist |
| 72 | + merge-multiple: true |
| 73 | + |
| 74 | + - name: Publish to PyPI |
| 75 | + if: steps.check-tag.outputs.match == 'true' |
| 76 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments