Skip to content

Commit 7ed3697

Browse files
committed
Add fallback protoc install step on Windows build
1 parent 4a00689 commit 7ed3697

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

.github/actions/prepare_environment/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,27 @@ runs:
127127
run: corepack enable
128128

129129
- name: Install protoc for generating rust bindings of protobuf APIs
130+
id: install_protoc
130131
# Install protoc for generating rust bindings of protobuf APIs.
131132
uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 # v1
133+
# Don't fail the job here so the winget fallback below has a chance to run on Windows.
134+
continue-on-error: true
132135
with:
133136
brew: protobuf
134137
choco: protoc
135138

139+
- name: Install protoc via winget (fallback for Windows)
140+
if: ${{ inputs.target_os == 'windows' && steps.install_protoc.outcome == 'failure' }}
141+
shell: pwsh
142+
run: winget install Google.Protobuf
143+
144+
- name: Fail if protoc install did not succeed
145+
if: ${{ inputs.target_os != 'windows' && steps.install_protoc.outcome == 'failure' }}
146+
shell: bash
147+
run: |
148+
echo "::error::protoc install step failed on ${{ inputs.target_os }}"
149+
exit 1
150+
136151
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
137152
if: ${{ inputs.target_os == 'macos' && inputs.is_self_hosted != 'true' }}
138153
with:

0 commit comments

Comments
 (0)