Publish Wheels #18
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: Publish Wheels | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build_wheels: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest, macos-13] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.x" | |
| - name: Upgrade pip and install cibuildwheel | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install cibuildwheel | |
| - name: Install dependencies with pre-built wheels | |
| run: | | |
| pip install --only-binary=:all: numpy pandas | |
| - name: Build wheels | |
| run: cibuildwheel --output-dir wheelhouse . | |
| - name: Upload built wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: wheelhouse/*.whl | |
| build_sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.x" | |
| - name: Install build | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Build sdist | |
| run: python -m build --sdist | |
| - name: Upload sdist artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| publish_wheels: | |
| needs: [build_wheels, build_sdist] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download wheel artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist-artifacts/wheels | |
| - name: Download sdist artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist-artifacts/sdist | |
| - name: Prepare distribution files | |
| run: | | |
| mkdir -p dist | |
| find dist-artifacts -name "*.whl" -exec cp {} dist/ \; | |
| find dist-artifacts -name "*.tar.gz" -exec cp {} dist/ \; | |
| ls -la dist/ | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Verify wheel structure | |
| run: | | |
| pip install twine check-wheel-contents | |
| twine check dist/* | |
| check-wheel-contents dist/*.whl | |
| - name: Publish package to Pypi | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # with: | |
| # repository-url: https://test.pypi.org/legacy/ # Target TestPyPI instead of PyPI |