Skip to content

Commit bcccd2a

Browse files
author
CoLiPas Builder
committed
Fix release fallback self-test on Linux
1 parent 5ee71f4 commit bcccd2a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

scripts/release-deploy.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ function Test-GitHubApiJsonFallback {
279279
$tempRoot = Join-Path ([IO.Path]::GetTempPath()) ("colipas-release-selftest-" + [Guid]::NewGuid().ToString("N"))
280280
New-Item -ItemType Directory -Path $tempRoot | Out-Null
281281
$mockGhPath = Join-Path $tempRoot "gh.cmd"
282+
$mockGhUnixPath = Join-Path $tempRoot "gh"
282283
$mockResponderPath = Join-Path $tempRoot "mock-gh-response.ps1"
283284
$capturePath = Join-Path $tempRoot "capture.json"
284285
$previousPath = $env:PATH
@@ -304,6 +305,30 @@ if "%input%"=="" exit /b 22
304305
powershell -NoProfile -ExecutionPolicy Bypass -File "%COLIPAS_GH_SELFTEST_RESPONDER%" "%input%"
305306
'@ | Set-Content -LiteralPath $mockGhPath -Encoding ASCII
306307
@'
308+
#!/usr/bin/env sh
309+
if [ "$1" != "api" ]; then
310+
exit 21
311+
fi
312+
313+
input=""
314+
while [ "$#" -gt 0 ]; do
315+
if [ "$1" = "--input" ]; then
316+
shift
317+
input="${1:-}"
318+
fi
319+
shift || true
320+
done
321+
322+
if [ -z "$input" ]; then
323+
exit 22
324+
fi
325+
326+
pwsh -NoProfile -ExecutionPolicy Bypass -File "$COLIPAS_GH_SELFTEST_RESPONDER" "$input"
327+
'@ | Set-Content -LiteralPath $mockGhUnixPath -Encoding ASCII
328+
if (Get-Command chmod -ErrorAction SilentlyContinue) {
329+
& chmod +x $mockGhUnixPath
330+
}
331+
@'
307332
param([string]$InputJsonPath)
308333
309334
$bytes = [IO.File]::ReadAllBytes($InputJsonPath)

0 commit comments

Comments
 (0)