mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[Windows] Cleanup various scripts (#8942)
* Use Resolve-GithubReleaseAssetUrl more widely * Add the Get-ChecksumFromUrl function * Sort exported functions and add docs * Remove alias and fix typo * Fix kind checksum url and syntax * Fix checksums url for gh cli and msys2 * [Windows] Cleanup various scripts * Add spaces after type specifications * Rename the Take-Part function
This commit is contained in:
committed by
GitHub
parent
ed911223ab
commit
5ed2615017
@@ -16,10 +16,11 @@ try {
|
||||
$release = $metadata.LTSReleaseTag[0] -replace '^v'
|
||||
$downloadUrl = "https://github.com/PowerShell/PowerShell/releases/download/v${release}/PowerShell-${release}-win-x64.msi"
|
||||
|
||||
$hashUrl = "https://github.com/PowerShell/PowerShell/releases/download/v${release}/hashes.sha256"
|
||||
$expectedSHA256Sum = (Invoke-RestMethod -Uri $hashURL).ToString().Split("`n").Where({ $_ -ilike "*PowerShell-${Release}-win-x64.msi*" }).Split(' ')[0]
|
||||
|
||||
Install-Binary -Url $downloadUrl -ExpectedSHA256Sum $expectedSHA256Sum
|
||||
$installerName = Split-Path $downloadUrl -Leaf
|
||||
$externalHash = Get-ChecksumFromUrl -Type "SHA256" `
|
||||
-Url ($downloadUrl -replace $installerName, "hashes.sha256") `
|
||||
-FileName $installerName
|
||||
Install-Binary -Url $downloadUrl -ExpectedSHA256Sum $externalHash
|
||||
} finally {
|
||||
# Restore original value
|
||||
[Net.ServicePointManager]::SecurityProtocol = $originalValue
|
||||
@@ -30,6 +31,6 @@ try {
|
||||
# While the update check happens during the first session in a given 24-hour period, for performance reasons,
|
||||
# the notification will only be shown on the start of subsequent sessions.
|
||||
# Also for performance reasons, the check will not start until at least 3 seconds after the session begins.
|
||||
[System.Environment]::SetEnvironmentVariable("POWERSHELL_UPDATECHECK", "Off", [System.EnvironmentVariableTarget]::Machine)
|
||||
[Environment]::SetEnvironmentVariable("POWERSHELL_UPDATECHECK", "Off", "Machine")
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "PowerShell Core"
|
||||
|
||||
Reference in New Issue
Block a user