mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
* 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
31 lines
1.2 KiB
PowerShell
31 lines
1.2 KiB
PowerShell
################################################################################
|
|
## File: Install-AliyunCli.ps1
|
|
## Desc: Install Alibaba Cloud CLI
|
|
## Supply chain security: Alibaba Cloud CLI - checksum validation
|
|
################################################################################
|
|
|
|
Write-Host "Download Latest aliyun-cli archive"
|
|
$downloadUrl = Resolve-GithubReleaseAssetUrl `
|
|
-Repo "aliyun/aliyun-cli" `
|
|
-Version "latest" `
|
|
-UrlMatchPattern "aliyun-cli-windows-*-amd64.zip"
|
|
$packagePath = Invoke-DownloadWithRetry $downloadUrl
|
|
|
|
#region Supply chain security - Alibaba Cloud CLI
|
|
$packageName = Split-Path $downloadUrl -Leaf
|
|
$externalHash = Get-ChecksumFromUrl -Type "SHA256" `
|
|
-Url ($downloadUrl -replace $packageName, "SHASUMS256.txt") `
|
|
-FileName $packageName
|
|
Test-FileChecksum $packagePath -ExpectedSHA256Sum $externalHash
|
|
#endregion
|
|
|
|
Write-Host "Expand aliyun-cli archive"
|
|
$aliyunPath = "C:\aliyun-cli"
|
|
New-Item -Path $aliyunPath -ItemType Directory -Force
|
|
Expand-7ZipArchive -Path $packagePath -DestinationPath $aliyunPath
|
|
|
|
# Add aliyun-cli to path
|
|
Add-MachinePathItem $aliyunPath
|
|
|
|
Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Aliyun CLI"
|