Skip to content

Commit a38a9f1

Browse files
crohrgithub-actions[bot]
authored andcommitted
Sync from upstream
1 parent d7d6ea7 commit a38a9f1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
################################################################################
2+
## File: Install-Runner.ps1
3+
## Desc: Install Runner for GitHub Actions
4+
## Supply chain security: none
5+
################################################################################
6+
7+
Write-Host "Download latest Runner for GitHub Actions"
8+
$downloadUrl = Resolve-GithubReleaseAssetUrl `
9+
-Repo "actions/runner" `
10+
-Version "latest" `
11+
-UrlMatchPattern "actions-runner-win-x64-*[0-9.].zip"
12+
$fileName = Split-Path $downloadUrl -Leaf
13+
New-Item -Path "C:\ProgramData\runner" -ItemType Directory
14+
Invoke-DownloadWithRetry -Url $downloadUrl -Path "C:\ProgramData\runner\$fileName"
15+
16+
# removed: # removed: Invoke-PesterTests
17+
# Patched into Install-Runner.ps1
18+
19+
# Create runner user
20+
$User = "runner"
21+
New-LocalUser -Name $User -NoPassword
22+
Add-LocalGroupMember -Group "Administrators" -Member $User
23+
24+
# Extract runner binary
25+
$runnerZipFile = "C:\ProgramData\runner\$fileName"
26+
$destination = "C:\actions-runner"
27+
28+
New-Item -Path $destination -ItemType Directory -Force
29+
Add-Type -AssemblyName System.IO.Compression.FileSystem
30+
[System.IO.Compression.ZipFile]::ExtractToDirectory($runnerZipFile, $destination)
31+
32+
# Remove runner binary after extraction
33+
Remove-Item $runnerZipFile -Force

0 commit comments

Comments
 (0)