mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 03:27:05 +00:00
[MacOS] Pin sha256 for xcode (#9007)
* pin sha256 for xcode * add sha256 for xcode 15.1
This commit is contained in:
@@ -6,7 +6,9 @@ function Install-XcodeVersion {
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Version,
|
||||
[Parameter(Mandatory)]
|
||||
[string] $LinkTo
|
||||
[string] $LinkTo,
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Sha256Sum
|
||||
)
|
||||
|
||||
$xcodeDownloadDirectory = "$env:HOME/Library/Caches/XcodeInstall"
|
||||
@@ -28,8 +30,15 @@ function Invoke-DownloadXcodeArchive {
|
||||
$tempXipDirectory = New-Item -Path $DownloadDirectory -Name "Xcode$Version" -ItemType "Directory"
|
||||
$xcodeFileName = 'Xcode-{0}.xip' -f $Version
|
||||
$xcodeUri = '{0}{1}?{2}'-f ${env:XCODE_INSTALL_STORAGE_URL}, $xcodeFileName, ${env:XCODE_INSTALL_SAS}
|
||||
Invoke-DownloadWithRetry -Url $xcodeUri -Path (Join-Path $tempXipDirectory.FullName $xcodeFileName) | Out-Null
|
||||
$xcodeFullPath = Join-Path $tempXipDirectory.FullName $xcodeFileName
|
||||
Invoke-DownloadWithRetry -Url $xcodeUri -Path $xcodeFullPath | Out-Null
|
||||
|
||||
# Validating checksum
|
||||
$xcodeSha256 = Get-FileHash -Path $xcodeFullPath -Algorithm SHA256 | Select-Object -ExpandProperty Hash
|
||||
if ($xcodeSha256 -ne $Sha256Sum) {
|
||||
throw "Xcode $Version checksum mismatch. Expected: $Sha256Sum, Actual: $xcodeSha256"
|
||||
}
|
||||
|
||||
return $tempXipDirectory
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user