Deploy to PYPI #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to PYPI | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| sdist: | |
| name: Build sdist | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Build sdist | |
| run: python -m build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: ./dist/*.tar.gz | |
| wheels: | |
| name: Build wheels | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, macos-14,windows-latest] | |
| env: | |
| MACOSX_DEPLOYMENT_TARGET: '15.0' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install cibuildwheel | |
| - if: matrix.os == 'macos-latest' || matrix.os == 'macos-14' | |
| run: | | |
| brew install cgal | |
| - name: Bootstrap & install with vcpkg on Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| $Env:VCPKG_ROOT = "${{ github.workspace }}\vcpkg" | |
| git clone https://github.com/microsoft/vcpkg $Env:VCPKG_ROOT | |
| & $Env:VCPKG_ROOT\bootstrap-vcpkg.bat | |
| & $Env:VCPKG_ROOT\vcpkg.exe install yasm-tool:x86-windows cgal:x64-windows | |
| # export VCPKG_ROOT so later steps can see it | |
| echo "VCPKG_ROOT=$Env:VCPKG_ROOT" >> $Env:GITHUB_ENV | |
| # now inject your extra CMake flags: | |
| echo "CMAKE_ARGS=-DCMAKE_TOOLCHAIN_FILE=$Env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake -DVCPKG_ROOT=$Env:VCPKG_ROOT" >> $Env:GITHUB_ENV | |
| - name: Build wheels | |
| run: | | |
| cibuildwheel --output-dir dist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: ./dist/* | |
| publish: | |
| name: Publish wheels and sdist to PyPI | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| needs: [wheels,sdist] | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Move all distributions to `dist/` | |
| run: | | |
| mkdir -p dist | |
| find artifacts -name '*.whl' -exec cp {} dist/ \; | |
| find artifacts -name '*.tar.gz' -exec cp {} dist/ \; | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| verbose: true | |
| packages-dir: dist/ | |