mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[Windows] Implement installation helpers refactoring (#8865)
* [Windows] Refactor base Installer helper functions * Fix helper name * Fix name gen logic and improve error handling * Fix hash checking logic * Fix Install-VsixExtension invocation * Fix variable name in Install-OpenSSL.ps1 * Fix type for git downloadUrl
This commit is contained in:
committed by
GitHub
parent
46f21c4413
commit
d3e630f774
@@ -7,19 +7,15 @@
|
||||
Write-Host "Get the latest gh version..."
|
||||
|
||||
$repoUrl = "https://api.github.com/repos/cli/cli/releases/latest"
|
||||
$installerFile = "gh_windows_amd64.msi"
|
||||
$assets = (Invoke-RestMethod -Uri $repoUrl).assets
|
||||
$downloadUrl = ($assets.browser_download_url -match "windows_amd64.msi") | Select-Object -First 1
|
||||
$packagePath = Start-DownloadWithRetry -Url $downloadUrl -Name $installerFile
|
||||
|
||||
#region Supply chain security - GitHub CLI
|
||||
$fileHash = (Get-FileHash -Path $packagePath -Algorithm SHA256).Hash
|
||||
$hashUrl = ($assets.browser_download_url -match "checksums.txt") | Select-Object -First 1
|
||||
$externalHash = (Invoke-RestMethod -Uri $hashURL).ToString().Split("`n").Where({ $_ -ilike "*windows_amd64.msi*" }).Split(' ')[0]
|
||||
Use-ChecksumComparison $fileHash $externalHash
|
||||
#endregion
|
||||
|
||||
Install-Binary -FilePath $packagePath
|
||||
Install-Binary `
|
||||
-Url $downloadUrl `
|
||||
-ExpectedSHA256Sum $externalHash
|
||||
|
||||
Add-MachinePathItem "C:\Program Files (x86)\GitHub CLI"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user