v1.10.5 — WSS supervisor + key-exchange + compat-dial fixes #40
Workflow file for this run
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 Python SDK | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to publish (without leading v, e.g. 1.9.1)' | |
| required: true | |
| type: string | |
| prerelease: | |
| description: 'Treat as prerelease (skip publish; build only)' | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write | |
| id-token: write | |
| env: | |
| PILOT_VERSION: ${{ inputs.version || github.event.release.tag_name }} | |
| PILOT_PRERELEASE: ${{ inputs.prerelease || github.event.release.prerelease }} | |
| jobs: | |
| test-sdk: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dev dependencies + run unit tests | |
| run: | | |
| cd sdk/python | |
| make install-dev | |
| make test | |
| timeout-minutes: 10 | |
| build-wheels: | |
| needs: test-sdk | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux | |
| - os: macos-latest | |
| platform: macos | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set version from release tag or workflow input | |
| shell: bash | |
| run: | | |
| VERSION="${PILOT_VERSION}" | |
| VERSION="${VERSION#v}" | |
| echo "version=$VERSION" >> $GITHUB_ENV | |
| cd sdk/python | |
| sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml | |
| rm pyproject.toml.bak | |
| echo "SDK version: $VERSION" | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| if [ "${{ matrix.platform }}" = "linux" ]; then | |
| pip install auditwheel patchelf | |
| fi | |
| - name: Build wheel | |
| shell: bash | |
| run: | | |
| cd sdk/python | |
| chmod +x scripts/build-binaries.sh scripts/build.sh | |
| ./scripts/build.sh | |
| - name: Convert to manylinux wheel (Linux only) | |
| if: matrix.platform == 'linux' | |
| shell: bash | |
| run: | | |
| cd sdk/python | |
| if auditwheel repair dist/*.whl --plat manylinux_2_35_x86_64 -w dist/ 2>/dev/null; then | |
| echo "Created manylinux_2_35 wheel" | |
| elif auditwheel repair dist/*.whl --plat manylinux_2_31_x86_64 -w dist/ 2>/dev/null; then | |
| echo "Created manylinux_2_31 wheel" | |
| elif auditwheel repair dist/*.whl --plat manylinux_2_28_x86_64 -w dist/ 2>/dev/null; then | |
| echo "Created manylinux_2_28 wheel" | |
| else | |
| echo "Could not repair to manylinux, keeping original linux wheel" | |
| fi | |
| rm -f dist/*-linux_x86_64.whl | |
| - name: Verify wheel | |
| shell: bash | |
| run: | | |
| cd sdk/python | |
| python -m twine check dist/* | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel-${{ matrix.os }} | |
| path: sdk/python/dist/*.whl | |
| retention-days: 7 | |
| - name: Upload sdist artifact (Linux only) | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: sdk/python/dist/*.tar.gz | |
| retention-days: 7 | |
| publish: | |
| needs: build-wheels | |
| if: ${{ !(inputs.prerelease || github.event.release.prerelease) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist-artifacts | |
| - name: Prepare distribution directory | |
| run: | | |
| mkdir -p dist | |
| find dist-artifacts -name "*.whl" -exec cp {} dist/ \; | |
| find dist-artifacts -name "*.tar.gz" -exec cp {} dist/ \; | |
| ls -lh dist/ | |
| - name: Extract version | |
| id: extract-version | |
| run: | | |
| WHEEL_FILE=$(ls dist/*.whl | head -1) | |
| VERSION=$(echo "$WHEEL_FILE" | sed -n 's/.*pilotprotocol-\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install twine | |
| run: pip install twine | |
| - name: Check if version exists on PyPI | |
| id: check-pypi | |
| run: | | |
| VERSION=${{ steps.extract-version.outputs.version }} | |
| if curl -s https://pypi.org/pypi/pilotprotocol/$VERSION/json | grep -q "\"version\": \"$VERSION\""; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Version $VERSION already exists on PyPI" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "Version $VERSION does not exist on PyPI" | |
| fi | |
| - name: Publish to PyPI | |
| if: steps.check-pypi.outputs.exists == 'false' | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: python -m twine upload dist/* | |
| - name: Skip publish - version exists | |
| if: steps.check-pypi.outputs.exists == 'true' | |
| run: echo "Skipping publish - version already exists on PyPI" | |
| - name: Create summary | |
| run: | | |
| echo "## Python SDK Published" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Version:** ${{ steps.extract-version.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Install:** \`pip install pilotprotocol\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**PyPI:** https://pypi.org/project/pilotprotocol/" >> $GITHUB_STEP_SUMMARY | |
| test-install: | |
| needs: publish | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Wait for PyPI propagation | |
| run: sleep 60 | |
| - name: Install and verify | |
| run: | | |
| pip install pilotprotocol | |
| pilotctl info 2>&1 | head -1 || true | |
| python -c "from pilotprotocol import Driver; print('SDK installed')" |