fix: render README images on PyPI/crates.io and bump version to 1.0.1… #7
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: Release SMG to PyPI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - bindings/python/pyproject.toml | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }}) | |
| runs-on: ${{ matrix.os }}-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu, macos, windows] | |
| target: [x86_64, aarch64] | |
| manylinux: [auto] | |
| include: | |
| - os: ubuntu | |
| platform: linux | |
| - os: windows | |
| ls: dir | |
| target: x86_64 | |
| python-architecture: x64 | |
| interpreter: 3.13 | |
| - os: macos | |
| target: x86_64 | |
| interpreter: 3.13 | |
| - os: macos | |
| target: aarch64 | |
| interpreter: 3.13 | |
| - os: ubuntu | |
| platform: linux | |
| target: aarch64 | |
| # musllinux | |
| - os: ubuntu | |
| platform: linux | |
| target: x86_64 | |
| manylinux: musllinux_1_1 | |
| - os: ubuntu | |
| platform: linux | |
| target: aarch64 | |
| manylinux: musllinux_1_1 | |
| exclude: | |
| - os: windows | |
| target: aarch64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| path: smg-repo | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| architecture: ${{ matrix.python-architecture || 'x64' }} | |
| - name: Install twine | |
| run: pip install -U twine | |
| - name: Install protoc (macOS) | |
| if: matrix.os == 'macos' | |
| run: brew install protobuf | |
| - name: Install protoc (Windows) | |
| if: matrix.os == 'windows' | |
| run: choco install protoc -y | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: smg-repo/bindings/python | |
| target: ${{ matrix.target }} | |
| manylinux: ${{ matrix.manylinux || 'auto' }} | |
| args: --release --out dist --features vendored-openssl --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13 3.14' }} | |
| rust-toolchain: stable | |
| docker-options: -e CI -e CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc -e CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ | |
| before-script-linux: | | |
| # Install build dependencies (perl/make for vendored OpenSSL, protoc for gRPC) | |
| if command -v yum &> /dev/null; then | |
| yum update -y && yum install -y wget unzip gcc gcc-c++ perl-core make | |
| # Install cross-compilation toolchain for aarch64 if needed | |
| if [ "${{ matrix.target }}" = "aarch64" ]; then | |
| yum install -y gcc-aarch64-linux-gnu gcc-c++-aarch64-linux-gnu || true | |
| fi | |
| elif command -v apt-get &> /dev/null; then | |
| apt-get update && apt-get install -y wget unzip gcc g++ perl make | |
| # Install cross-compilation toolchain for aarch64 if needed | |
| if [ "${{ matrix.target }}" = "aarch64" ]; then | |
| apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu || true | |
| fi | |
| fi | |
| (cd /tmp && \ | |
| wget https://github.com/protocolbuffers/protobuf/releases/download/v32.0/protoc-32.0-linux-x86_64.zip && \ | |
| unzip protoc-32.0-linux-x86_64.zip -d /usr/local && \ | |
| rm protoc-32.0-linux-x86_64.zip) | |
| protoc --version | |
| - name: List built packages | |
| run: ${{ matrix.ls || 'ls -lh' }} smg-repo/bindings/python/dist/ | |
| - name: Check packages | |
| run: twine check --strict smg-repo/bindings/python/dist/* | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: packages-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux || 'auto' }} | |
| path: smg-repo/bindings/python/dist/ | |
| build-sdist: | |
| name: Build SDist | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| path: smg-repo | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Build SDist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: smg-repo/bindings/python | |
| command: sdist | |
| args: --out dist | |
| rust-toolchain: stable | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: sdist | |
| path: smg-repo/bindings/python/dist/*.tar.gz | |
| upload: | |
| name: Upload to PyPI | |
| if: github.repository == 'lightseekorg/smg' # Ensure this job only runs for the lightseekorg/smg repository | |
| needs: [build, build-sdist] | |
| runs-on: ubuntu-latest | |
| permissions: {} | |
| steps: | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Upload to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_ROUTER }} | |
| run: | | |
| pip install twine | |
| twine upload dist/* --verbose |