2023-10-12 04:43:41 -04:00
|
|
|
################################################################################
|
2023-11-16 11:20:11 +01:00
|
|
|
## File: Install-ActionsCache.ps1
|
|
|
|
|
## Desc: Downloads latest release from https://github.com/actions/action-versions
|
2023-10-12 04:43:41 -04:00
|
|
|
## Maintainer: #actions-runtime and @TingluoHuang
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2023-12-11 22:23:36 +01:00
|
|
|
$actionArchiveCache = "C:\actionarchivecache\"
|
|
|
|
|
|
|
|
|
|
if (-not (Test-Path $actionArchiveCache)) {
|
2023-10-12 04:43:41 -04:00
|
|
|
Write-Host "Creating action archive cache folder"
|
2023-12-11 22:23:36 +01:00
|
|
|
New-Item -ItemType Directory -Path $actionArchiveCache | Out-Null
|
2023-10-12 04:43:41 -04:00
|
|
|
}
|
|
|
|
|
|
2023-11-28 15:08:03 +01:00
|
|
|
$downloadUrl = Resolve-GithubReleaseAssetUrl `
|
|
|
|
|
-Repo "actions/action-versions" `
|
|
|
|
|
-Version "latest" `
|
|
|
|
|
-Asset "action-versions.zip"
|
|
|
|
|
|
2023-10-12 04:43:41 -04:00
|
|
|
Write-Host "Download Latest action-versions archive from $downloadUrl"
|
2023-11-29 13:02:29 +01:00
|
|
|
$actionVersionsArchivePath = Invoke-DownloadWithRetry $downloadUrl
|
2023-10-12 04:43:41 -04:00
|
|
|
|
|
|
|
|
Write-Host "Expand action-versions archive"
|
2023-12-11 22:23:36 +01:00
|
|
|
Expand-7ZipArchive -Path $actionVersionsArchivePath -DestinationPath $actionArchiveCache
|
|
|
|
|
|
|
|
|
|
[Environment]::SetEnvironmentVariable("ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE", $actionArchiveCache, "Machine")
|
2023-10-12 04:43:41 -04:00
|
|
|
|
|
|
|
|
Invoke-PesterTests -TestFile "ActionArchiveCache"
|