|
| 1 | +name: Publish PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-sdist: |
| 13 | + name: Build sdist |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Check out repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Set up Python |
| 20 | + uses: actions/setup-python@v5 |
| 21 | + with: |
| 22 | + python-version: "3.12" |
| 23 | + |
| 24 | + - name: Install build frontend |
| 25 | + run: python -m pip install build |
| 26 | + |
| 27 | + - name: Build source distribution |
| 28 | + run: python -m build --sdist |
| 29 | + |
| 30 | + - name: Upload source distribution |
| 31 | + uses: actions/upload-artifact@v4 |
| 32 | + with: |
| 33 | + name: dist-sdist |
| 34 | + path: dist/*.tar.gz |
| 35 | + |
| 36 | + build-wheels: |
| 37 | + name: Build wheels (${{ matrix.os }}) |
| 38 | + runs-on: ${{ matrix.os }} |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + matrix: |
| 42 | + os: [ubuntu-latest, windows-latest, macos-13, macos-14] |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Check out repository |
| 46 | + uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: Set up Python |
| 49 | + uses: actions/setup-python@v5 |
| 50 | + with: |
| 51 | + python-version: "3.12" |
| 52 | + |
| 53 | + - name: Install cibuildwheel |
| 54 | + run: python -m pip install cibuildwheel |
| 55 | + |
| 56 | + - name: Build wheels |
| 57 | + run: python -m cibuildwheel --output-dir wheelhouse |
| 58 | + env: |
| 59 | + CIBW_BUILD: cp310-* cp311-* cp312-* cp313-* |
| 60 | + CIBW_SKIP: *-musllinux_* *-win32 |
| 61 | + CIBW_ARCHS_LINUX: auto64 |
| 62 | + CIBW_ARCHS_WINDOWS: auto64 |
| 63 | + CIBW_ARCHS_MACOS: auto64 |
| 64 | + |
| 65 | + - name: Upload wheel artifacts |
| 66 | + uses: actions/upload-artifact@v4 |
| 67 | + with: |
| 68 | + name: dist-wheels-${{ matrix.os }} |
| 69 | + path: wheelhouse/*.whl |
| 70 | + |
| 71 | + publish: |
| 72 | + name: Publish to PyPI |
| 73 | + runs-on: ubuntu-latest |
| 74 | + needs: [build-sdist, build-wheels] |
| 75 | + permissions: |
| 76 | + id-token: write |
| 77 | + contents: read |
| 78 | + environment: |
| 79 | + name: pypi |
| 80 | + url: https://pypi.org/p/pycddp |
| 81 | + |
| 82 | + steps: |
| 83 | + - name: Download distribution artifacts |
| 84 | + uses: actions/download-artifact@v4 |
| 85 | + with: |
| 86 | + pattern: dist-* |
| 87 | + path: dist |
| 88 | + merge-multiple: true |
| 89 | + |
| 90 | + - name: Publish distributions |
| 91 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments