mirror of
https://github.com/actions/runner-images.git
synced 2026-01-10 04:35:12 +08:00
[Windows] Implement new directories hierarchy (#8616)
This commit is contained in:
committed by
GitHub
parent
84a7deae24
commit
d1f2c9a3be
45
images/windows/scripts/build/Update-ImageData.ps1
Normal file
45
images/windows/scripts/build/Update-ImageData.ps1
Normal file
@@ -0,0 +1,45 @@
|
||||
$os = Get-CimInstance -ClassName Win32_OperatingSystem
|
||||
$caption = $os.Caption
|
||||
$osName = $caption.Substring(0, $caption.LastIndexOf(" "))
|
||||
$osEdition = $caption.Substring($caption.LastIndexOf(" ") + 1)
|
||||
$osVersion = $os.Version
|
||||
$imageVersion = $env:IMAGE_VERSION
|
||||
$imageVersionComponents = $imageVersion.Split('.')
|
||||
$imageMajorVersion = $imageVersionComponents[0]
|
||||
$imageMinorVersion = $imageVersionComponents[1]
|
||||
$imageDataFile = $env:IMAGEDATA_FILE
|
||||
$githubUrl = "https://github.com/actions/runner-images/blob"
|
||||
|
||||
if (Test-IsWin22) {
|
||||
$imageLabel = "windows-2022"
|
||||
$softwareUrl = "${githubUrl}/win22/$imageMajorVersion.$imageMinorVersion/images/windows/Windows2022-Readme.md"
|
||||
$releaseUrl = "https://github.com/actions/runner-images/releases/tag/win22%2F$imageMajorVersion.$imageMinorVersion"
|
||||
} elseif (Test-IsWin19) {
|
||||
$imageLabel = "windows-2019"
|
||||
$softwareUrl = "${githubUrl}/win19/$imageMajorVersion.$imageMinorVersion/images/windows/Windows2019-Readme.md"
|
||||
$releaseUrl = "https://github.com/actions/runner-images/releases/tag/win19%2F$imageMajorVersion.$imageMinorVersion"
|
||||
} else {
|
||||
throw "Invalid platform version is found. Either Windows Server 2019 or 2022 are required"
|
||||
}
|
||||
|
||||
$json = @"
|
||||
[
|
||||
{
|
||||
"group": "Operating System",
|
||||
"detail": "${osName}\n${osVersion}\n${osEdition}"
|
||||
},
|
||||
{
|
||||
"group": "Runner Image",
|
||||
"detail": "Image: ${imageLabel}\nVersion: ${imageVersion}\nIncluded Software: ${softwareUrl}\nImage Release: ${releaseUrl}"
|
||||
}
|
||||
]
|
||||
"@
|
||||
|
||||
$json | Out-File -FilePath $imageDataFile
|
||||
|
||||
|
||||
# Set static env vars
|
||||
setx ImageVersion $env:IMAGE_VERSION /m
|
||||
setx ImageOS $env:IMAGE_OS /m
|
||||
setx AGENT_TOOLSDIRECTORY $env:AGENT_TOOLSDIRECTORY /m
|
||||
setx ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE $env:ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE /m
|
||||
Reference in New Issue
Block a user