From c8f652630bd48716c69710433e532438f92f6521 Mon Sep 17 00:00:00 2001 From: Daniel Peng Date: Tue, 28 Apr 2026 08:53:03 -0700 Subject: [PATCH] Add fallback protoc install step on Windows build (#9230) --- .github/actions/prepare_environment/action.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/actions/prepare_environment/action.yml b/.github/actions/prepare_environment/action.yml index 7594cc06..817f60f3 100644 --- a/.github/actions/prepare_environment/action.yml +++ b/.github/actions/prepare_environment/action.yml @@ -127,12 +127,27 @@ runs: run: corepack enable - name: Install protoc for generating rust bindings of protobuf APIs + id: install_protoc # Install protoc for generating rust bindings of protobuf APIs. uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 # v1 + # Don't fail the job here so the winget fallback below has a chance to run on Windows. + continue-on-error: true with: brew: protobuf choco: protoc + - name: Install protoc via winget (fallback for Windows) + if: ${{ inputs.target_os == 'windows' && steps.install_protoc.outcome == 'failure' }} + shell: pwsh + run: winget install Google.Protobuf + + - name: Fail if protoc install did not succeed + if: ${{ inputs.target_os != 'windows' && steps.install_protoc.outcome == 'failure' }} + shell: bash + run: | + echo "::error::protoc install step failed on ${{ inputs.target_os }}" + exit 1 + - uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0 if: ${{ inputs.target_os == 'macos' && inputs.is_self_hosted != 'true' }} with: