Switch Expand-Archive to 7zip on Windows image generation (#861)

* switch expand-archive to 7zip on windows
This commit is contained in:
Dibir Magomedsaygitov
2020-05-13 08:02:08 +03:00
committed by GitHub
parent ffa2110464
commit 3e9c8e5afc
10 changed files with 37 additions and 17 deletions

View File

@@ -15,7 +15,7 @@ function Install-GoVersion
[Switch] $addToDefaultPath
)
$latestVersionObject = $refsJson | Where-Object { $_.ref -Match "refs/tags/go$goVersion[./d]*" } | Select-Object -Last 1
$latestVersionObject = $refsJson | Where-Object { $_.ref -Match "refs/tags/go$goVersion[./d]*" } | Select-Object -Last 1
$latestVersion = $latestVersionObject.ref.replace('refs/tags/go','')
# Download the Go zip archive.
@@ -30,7 +30,7 @@ function Install-GoVersion
# Extract the zip archive. It contains a single directory named "go".
Write-Host "Extracting Go $latestVersion..."
$toolDirectory = Join-Path $env:AGENT_TOOLSDIRECTORY "go\$latestVersion"
7z.exe x $goArchPath -o"$toolDirectory" -y | Out-Null
Extract-7Zip -Path $goArchPath -DestinationPath $toolDirectory
# Rename the extracted "go" directory to "x64" for full path "C:\hostedtoolcache\windows\Go\1.14.2\x64\..."
Rename-Item -path "$toolDirectory\go" -newName "x64"