mirror of
https://github.com/actions/runner-images.git
synced 2026-01-02 08:07:44 +08: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
33 lines
1.2 KiB
PowerShell
33 lines
1.2 KiB
PowerShell
################################################################################
|
|
## File: Install-Miniconda.ps1
|
|
## Desc: Install the latest version of Miniconda and set $env:CONDA
|
|
## Supply chain security: checksum validation
|
|
################################################################################
|
|
|
|
$CondaDestination = "C:\Miniconda"
|
|
$InstallerName = "Miniconda3-latest-Windows-x86_64.exe"
|
|
|
|
#region Supply chain security
|
|
$distributorFileHash = $null
|
|
$checksums = (Invoke-RestMethod -Uri 'https://repo.anaconda.com/miniconda/' | ConvertFrom-HTML).SelectNodes('//html/body/table/tr')
|
|
|
|
foreach ($node in $checksums) {
|
|
if ($node.ChildNodes[1].InnerText -eq $InstallerName) {
|
|
$distributorFileHash = $node.ChildNodes[7].InnerText
|
|
}
|
|
}
|
|
|
|
if ($null -eq $distributorFileHash) {
|
|
throw "Unable to find checksum for $InstallerName in https://repo.anaconda.com/miniconda/"
|
|
}
|
|
#endregion
|
|
|
|
Install-Binary `
|
|
-Url "https://repo.anaconda.com/miniconda/${InstallerName}" `
|
|
-InstallArgs @("/S", "/AddToPath=0", "/RegisterPython=0", "/D=$CondaDestination") `
|
|
-ExpectedSHA256Sum $distributorFileHash
|
|
|
|
[Environment]::SetEnvironmentVariable("CONDA", $CondaDestination, "Machine")
|
|
|
|
Invoke-PesterTests -TestFile "Miniconda"
|