Skip to content

Commit dfa465b

Browse files
fix: fix install runner for windows
1 parent aea7f65 commit dfa465b

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

modules/runners/templates/install-runner.ps1

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
## install the runner
22

33
Write-Host "Creating actions-runner directory for the GH Action installation"
4-
New-Item -ItemType Directory -Path C:\actions-runner ; Set-Location C:\actions-runner
4+
New-Item -ItemType Directory -Path C:\actions-runner -Force | Out-Null
5+
Set-Location C:\actions-runner
56

6-
Write-Host "Downloading the GH Action runner from s3 bucket $s3_location"
7-
aws s3 cp ${S3_LOCATION_RUNNER_DISTRIBUTION} actions-runner.zip
7+
$runnerTarballUrl = $Env:RUNNER_TARBALL_URL
8+
$s3RunnerDistribution = $Env:S3_LOCATION_RUNNER_DISTRIBUTION
9+
10+
if ([string]::IsNullOrWhiteSpace($runnerTarballUrl) -and [string]::IsNullOrWhiteSpace($s3RunnerDistribution)) {
11+
Write-Host "Neither RUNNER_TARBALL_URL nor S3_LOCATION_RUNNER_DISTRIBUTION are set" -ForegroundColor Red
12+
exit 1
13+
}
14+
15+
$fileName = "actions-runner.zip"
16+
17+
if (-not [string]::IsNullOrWhiteSpace($runnerTarballUrl)) {
18+
Write-Host "Downloading the GH Action runner from $runnerTarballUrl to $fileName"
19+
Invoke-WebRequest -Uri $runnerTarballUrl -OutFile $fileName -UseBasicParsing
20+
}
21+
else {
22+
Write-Host "Downloading the GH Action runner from s3 bucket $s3RunnerDistribution"
23+
aws s3 cp $s3RunnerDistribution $fileName | Out-Null
24+
}
825

926
Write-Host "Un-zip action runner"
1027
Expand-Archive -Path actions-runner.zip -DestinationPath .

0 commit comments

Comments
 (0)