mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 12:48:18 +00:00
[Mac OS] Update Anka Helpers to build Mac OS 14 ARM image (#8757)
* Update Anka Helpers to build Mac OS 14 ARM image * Drop Powershell 5 support
This commit is contained in:
committed by
GitHub
parent
be3fa4f3c3
commit
bbbda7bddf
@@ -63,24 +63,24 @@ function Get-AvailableIPSWVersions {
|
||||
)
|
||||
|
||||
if ($IsBeta) {
|
||||
$command = { mist list firmware "$MacOSCodeNameOrVersion" --include-betas --latest --export "/Applications/export.json"}
|
||||
$command = { mist list firmware "$MacOSCodeNameOrVersion" --compatible --include-betas --latest --export "/Applications/export.json" }
|
||||
} elseif ($IsLatest) {
|
||||
$command = { mist list firmware "$MacOSCodeNameOrVersion" --latest --export "/Applications/export.json" }
|
||||
$command = { mist list firmware "$MacOSCodeNameOrVersion" --compatible --latest --export "/Applications/export.json" }
|
||||
} else {
|
||||
$command = { mist list firmware "$MacOSCodeNameOrVersion" --export "/Applications/export.json" }
|
||||
$command = { mist list firmware "$MacOSCodeNameOrVersion" --compatible --export "/Applications/export.json" }
|
||||
}
|
||||
|
||||
$condition = { $LASTEXITCODE -eq 0 }
|
||||
Invoke-WithRetry -Command $command -BreakCondition $condition | Out-Null
|
||||
$softwareList = get-content -Path "/Applications/export.json"
|
||||
$turgetVersion = ($softwareList | ConvertFrom-Json).version
|
||||
if ($null -eq $turgetVersion) {
|
||||
$availableBuilds = ($softwareList | ConvertFrom-Json).build
|
||||
if ($null -eq $availableBuilds) {
|
||||
Write-Host "Requested macOS '$MacOSCodeNameOrVersion' version not found in the list of available installers."
|
||||
$command = { mist list firmware "$($MacOSCodeNameOrVersion.split('.')[0])" }
|
||||
Invoke-WithRetry -Command $command -BreakCondition $condition
|
||||
exit 1
|
||||
}
|
||||
return $turgetVersion
|
||||
return $availableBuilds
|
||||
}
|
||||
|
||||
function Get-MacOSIPSWInstaller {
|
||||
@@ -100,17 +100,20 @@ function Get-MacOSIPSWInstaller {
|
||||
$MacOSName = $MacOSVersion.ToString()
|
||||
}
|
||||
|
||||
|
||||
Write-Host "`t[*] Finding available full installers"
|
||||
if ($DownloadLatestVersion -eq $true) {
|
||||
$targetVersion = Get-AvailableIPSWVersions -IsLatest $true -MacOSCodeNameOrVersion $MacOSName
|
||||
Write-host "`t[*] The 'DownloadLatestVersion' flag is set to true. Latest macOS version is '$MacOSName' - '$targetVersion' now"
|
||||
$targetBuild = Get-AvailableIPSWVersions -IsLatest $true -MacOSCodeNameOrVersion $MacOSName
|
||||
Write-Host "`t[*] The 'DownloadLatestVersion' flag is set to true. Latest compatible macOS build of '$MacOSName' is '$targetBuild'"
|
||||
} elseif ($BetaSearch -eq $true) {
|
||||
$targetVersion = Get-AvailableIPSWVersions -IsBeta $true -MacOSCodeNameOrVersion $MacOSName
|
||||
Write-host "`t[*] The 'BetaSearch' flag is set to true. Latestbeta macOS version is '$MacOSName' - '$targetVersion' now"
|
||||
$targetBuild = Get-AvailableIPSWVersions -IsBeta $true -MacOSCodeNameOrVersion $MacOSName
|
||||
Write-Host "`t[*] The 'BetaSearch' flag is set to true. Latest compatible beta macOS build of '$MacOSName' is '$targetBuild'"
|
||||
} else {
|
||||
$targetVersion = Get-AvailableIPSWVersions -MacOSCodeNameOrVersion $MacOSName -IsLatest $false
|
||||
Write-host "`t[*] The exact version was specified - '$MacOSName' "
|
||||
$targetBuild = Get-AvailableIPSWVersions -MacOSCodeNameOrVersion $MacOSName -IsLatest $false
|
||||
Write-Host "`t[*] Available compatible macOS builds of '$MacOSName' are: $($targetBuild -join ', ')"
|
||||
if ($targetBuild.Count -gt 1) {
|
||||
Write-Error "`t[*] Please specify the exact build number of macOS you want to install"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
$installerPathPattern = "/Applications/Install ${macOSName}*.ipsw"
|
||||
@@ -123,12 +126,12 @@ function Get-MacOSIPSWInstaller {
|
||||
# Download macOS installer
|
||||
$installerDir = "/Applications/"
|
||||
$installerName = "Install ${macOSName}.ipsw"
|
||||
Write-Host "`t[*] Requested macOS '$targetVersion' version installer found, fetching it from mist database"
|
||||
Invoke-WithRetry { mist download firmware "$targetVersion" --output-directory $installerDir --firmware-name "$installerName" } {$LASTEXITCODE -eq 0} | Out-Null
|
||||
Write-Host "`t[*] Requested macOS '$targetBuild' version installer found, fetching it from mist database"
|
||||
Invoke-WithRetry { mist download firmware "$targetBuild" --output-directory $installerDir --firmware-name "$installerName" } { $LASTEXITCODE -eq 0 } | Out-Null
|
||||
if (Test-Path "$installerDir$installerName") {
|
||||
$result = "$installerDir$installerName"
|
||||
} else {
|
||||
Write-host "`t[*] Requested macOS '$targetVersion' version installer failed to download"
|
||||
Write-Error "`t[*] Requested macOS '$targetBuild' version installer failed to download"
|
||||
exit 1
|
||||
}
|
||||
return $result
|
||||
@@ -302,7 +305,11 @@ function Invoke-SSHPassCommand {
|
||||
"${env:SSHUSER}@${HostName}"
|
||||
)
|
||||
$sshPassOptions = $sshArg -join " "
|
||||
if ($PSVersionTable.PSVersion.Major -eq 7 -and $PSVersionTable.PSVersion.Minor -le 2) {
|
||||
$result = bash -c "$sshPassOptions \""$Command\"" 2>&1"
|
||||
} else {
|
||||
$result = bash -c "$sshPassOptions `"$Command`" 2>&1"
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "There is an error during command execution:`n$result"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user