Skip to content

Commit 265b710

Browse files
committed
github: workflows: Search the install candidates of WiX
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 7308334 commit 265b710

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/call-build-windows.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,41 @@ jobs:
213213
with:
214214
args: install wixtoolset -y
215215

216+
- name: Export WiX Toolset path
217+
if: ${{ matrix.config.arch == 'amd64_arm64' }}
218+
run: |
219+
$wix = [Environment]::GetEnvironmentVariable("WIX", "Machine")
220+
if (-not $wix) {
221+
$wix = [Environment]::GetEnvironmentVariable("WIX", "Process")
222+
}
223+
if (-not $wix) {
224+
$candidates = @(
225+
"${env:ProgramFiles(x86)}",
226+
"${env:ProgramFiles}"
227+
) | Where-Object { $_ -and (Test-Path $_) }
228+
foreach ($candidate in $candidates) {
229+
$wix = Get-ChildItem -Path $candidate -Directory -Filter "WiX Toolset v*" |
230+
Sort-Object Name -Descending |
231+
Select-Object -First 1 -ExpandProperty FullName
232+
if ($wix) {
233+
break
234+
}
235+
}
236+
}
237+
if (-not $wix) {
238+
throw "WiX Toolset installation path could not be located"
239+
}
240+
241+
$wixBin = Join-Path $wix "bin"
242+
if (!(Test-Path (Join-Path $wixBin "candle.exe")) -or
243+
!(Test-Path (Join-Path $wixBin "light.exe"))) {
244+
throw "WiX Toolset candle.exe/light.exe could not be located in $wixBin"
245+
}
246+
247+
"WIX=$wix" | Out-File -FilePath $env:GITHUB_ENV -Append
248+
$wixBin | Out-File -FilePath $env:GITHUB_PATH -Append
249+
shell: pwsh
250+
216251
# http://man7.org/linux/man-pages/man1/date.1.html
217252
- name: Get Date
218253
id: get-date

0 commit comments

Comments
 (0)