update to protobuf gencode 5, depends on protobuf >= 5 (#723) #403
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 Protocol | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - livekit-protocol/** | |
| tags: | |
| - "protocol-v*.*.*" | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - livekit-protocol/** | |
| workflow_dispatch: | |
| env: | |
| PACKAGE_DIR: ./livekit-protocol | |
| jobs: | |
| generate_protobuf: | |
| runs-on: ubuntu-latest | |
| name: Generating protobuf | |
| if: github.event_name == 'pull_request' | |
| defaults: | |
| run: | |
| working-directory: ${{ env.PACKAGE_DIR }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: true | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 | |
| - name: Install Protoc | |
| # protoc 29.x emits gencode 5.x. Do NOT bump to 30+ (gencode 6+): the | |
| # protobuf runtime is capped at <7 by livekit-agents deps | |
| # (opentelemetry-proto, grpcio-tools), and generate_proto.sh enforces a | |
| # gencode<=5 guard. gencode 5 loads on any runtime >=5 (5/6/7). See the | |
| # comment block in livekit-protocol/generate_proto.sh. | |
| uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3 | |
| with: | |
| version: "29.3" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: generate python stubs | |
| run: ./generate_proto.sh | |
| - name: Add changes | |
| uses: EndBug/add-and-commit@290ea2c423ad77ca9c62ae0f5b224379612c0321 # v10 | |
| with: | |
| add: '["livekit-protocol/"]' | |
| default_author: github_actions | |
| message: generated protobuf | |
| build_wheels: | |
| name: Build Protocol wheel/sdist | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ${{ env.PACKAGE_DIR }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 | |
| - name: Build wheel & sdist | |
| run: | | |
| pip3 install build wheel | |
| python3 -m build --wheel --sdist | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: protocol-release | |
| path: | | |
| livekit-protocol/dist/*.whl | |
| livekit-protocol/dist/*.tar.gz | |
| publish: | |
| name: Publish Protocol release | |
| needs: build_wheels | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| if: startsWith(github.ref, 'refs/tags/protocol-v') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: protocol-release | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 | |
| docs: | |
| needs: [publish] | |
| uses: ./.github/workflows/build-docs.yml | |
| with: | |
| package_dir: "livekit-protocol" | |
| package_name: "livekit.protocol" | |
| secrets: inherit |