Build and Publish #28
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: Build and Publish | |
| on: workflow_dispatch | |
| permissions: | |
| actions: write | |
| jobs: | |
| build-manylinux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: python -m pip install -U pip setuptools | |
| - name: Build manylinux Python wheels | |
| uses: RalfG/[email protected]_x86_64 | |
| with: | |
| python-versions: 'cp311-cp311 cp312-cp312' | |
| build-requirements: 'pybind11' | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: manylinux-wheels | |
| path: dist/*manylinux*.whl | |
| overwrite: true | |
| build-macos: | |
| runs-on: ${{ matrix.platform }} | |
| strategy: | |
| max-parallel: 8 | |
| matrix: | |
| platform: | |
| - macos-latest | |
| python-version: [ "3.11", "3.12" ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: python -m pip install -U pip setuptools | |
| - name: Build macos Python wheel | |
| run: python -m pip wheel . --no-deps -w ./dist | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "macos-wheels-${{ matrix.python-version }}" | |
| path: dist/*.whl | |
| overwrite: true | |
| build-windows: | |
| runs-on: ${{ matrix.platform }} | |
| strategy: | |
| max-parallel: 8 | |
| matrix: | |
| platform: | |
| - windows-latest | |
| python-version: [ "3.11", "3.12" ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: python -m pip install -U pip setuptools | |
| - name: Setup MSVC toolset | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: amd64 | |
| toolset: 14.2 | |
| - name: Build windows Python wheel | |
| run: python -m pip wheel . --no-deps -w ./dist | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "windows-wheels-${{ matrix.python-version }}" | |
| path: dist/*.whl | |
| overwrite: true | |
| upload-to-pypi: | |
| needs: [build-manylinux, build-macos, build-windows] | |
| environment: PyPI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install -U pip setuptools | |
| python -m pip install poetry twine | |
| - name: Build Python sdist | |
| run: poetry build -f sdist | |
| - name: Download manylinux wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: "manylinux-wheels" | |
| path: dist | |
| - name: Download all wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*-wheels-*" | |
| path: dist | |
| merge-multiple: true | |
| - name: Display dist files to upload to PyPI | |
| run: ls -R | |
| working-directory: dist | |
| - name: Upload wheels to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| run: twine upload dist/python_rtspm-* |