Last active
August 22, 2023 13:49
-
-
Save worldofgeese/197e26b0e6c3daaf8aa75a70e476101a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the base directory | |
$baseDir = Join-Path (Resolve-Path "~") ".garden" | |
$gardenBinPath = Join-Path $baseDir "bin" | |
# Remove existing Garden binary directory | |
Remove-Item -Path $baseDir -Recurse -Force -ErrorAction SilentlyContinue | |
# Fetch the latest Garden release URL for Windows | |
$releaseData = Invoke-RestMethod -Uri "https://api.github.com/repos/garden-io/garden/releases/latest" | |
$assetUrl = $releaseData.assets | Where-Object { $_.browser_download_url -match "windows-amd64.zip$" } | Select-Object -ExpandProperty browser_download_url | |
# Download and extract the zip to a temporary directory | |
$tempDir = New-TemporaryFile | % { Remove-Item $_; New-Item -ItemType Directory -Path $_ } | |
Invoke-WebRequest -Uri $assetUrl -OutFile "$tempDir\garden-windows-amd64.zip" | |
Expand-Archive -Path "$tempDir\garden-windows-amd64.zip" -DestinationPath $tempDir | |
# Install garden | |
Write-Host "-> Extracting archive..." | |
Copy-Item -Force -Recurse -Path "$tempDir\windows-amd64" -Destination $gardenBinPath | |
# Set the git config | |
git config --global safe.directory (Join-Path $baseDir "static") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment