mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 20:56:47 +00:00
[macOS] Refactor Common.Helpers (#8924)
* [macOS] Refactor Common.Helpers * Update readme file * Remove unnecessary double quotes --------- Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
This commit is contained in:
@@ -6,8 +6,7 @@
|
||||
|
||||
Import-Module "~/image-generation/helpers/Common.Helpers.psm1"
|
||||
|
||||
function Get-ToolsetToolFullPath
|
||||
{
|
||||
function Get-ToolsetToolFullPath {
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory)] [string] $ToolName,
|
||||
@@ -23,25 +22,23 @@ function Get-ToolsetToolFullPath
|
||||
}
|
||||
|
||||
$arch = Get-Architecture
|
||||
$toolcache = Get-ToolsetValue "toolcache"
|
||||
$toolcache = (Get-ToolsetContent).toolcache
|
||||
|
||||
foreach ($tool in $toolcache)
|
||||
{
|
||||
foreach ($tool in $toolcache) {
|
||||
$toolName = $tool.name
|
||||
$toolEnvironment = $tool.arch.$arch.variable_template
|
||||
|
||||
if (-not $toolEnvironment)
|
||||
{
|
||||
if (-not $toolEnvironment) {
|
||||
continue
|
||||
}
|
||||
|
||||
foreach ($toolVersion in $tool.arch.$arch.versions)
|
||||
{
|
||||
foreach ($toolVersion in $tool.arch.$arch.versions) {
|
||||
Write-Host "Set $toolName $toolVersion environment variable..."
|
||||
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $arch
|
||||
$envName = $toolEnvironment -f $toolVersion.split(".")
|
||||
|
||||
# Add environment variable name=value
|
||||
Add-EnvironmentVariable -Name $envName -Value $toolPath
|
||||
$envVar = "export {0}={1}" -f $envName, $toolPath
|
||||
Add-Content -Path "${env:HOME}/.bashrc" -Value $envVar
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user