Files
bun.sh/scripts/download-zig.ps1
dave caruso b76376f8a6 chore: upgrade zig to 0.13.0 (#9965)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Grigory <grigory.orlov.set@gmail.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
Co-authored-by: Meghan Denny <hello@nektro.net>
Co-authored-by: Kenta Iwasaki <63115601+lithdew@users.noreply.github.com>
Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
Co-authored-by: Dale Seo <5466341+DaleSeo@users.noreply.github.com>
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2024-06-20 13:48:39 -07:00

42 lines
1.1 KiB
PowerShell

$ErrorActionPreference = "Stop"
$ZigVersion="0.13.0"
$Target="windows"
$Arch="x86_64"
$Url = "https://ziglang.org/builds/zig-${Target}-${Arch}-${ZigVersion}.zip"
$CacheDir = (mkdir -Force (Join-Path $PSScriptRoot "../.cache"))
$TarPath = Join-Path $CacheDir "zig-${ZigVersion}.zip"
$OutDir = Join-Path $CacheDir "zig"
if (Test-Path $OutDir\.tag) {
$CurrentTag = Get-Content -Path (Join-Path $OutDir ".tag")
if ($CurrentTag -eq $ZigVersion) {
return
}
}
Remove-Item $OutDir -ErrorAction SilentlyContinue -Recurse
$null = mkdir -Force $OutDir
Push-Location $CacheDir
try {
if (!(Test-Path $TarPath)) {
try {
Write-Host "-- Downloading Zig"
Invoke-WebRequest $Url -OutFile $TarPath
} catch {
Write-Error "Failed to fetch Zig from: $Url"
throw $_
}
}
Remove-Item "$OutDir" -Recurse
Expand-Archive "$TarPath" "$OutDir\..\"
Move-Item "zig-$Target-$Arch-$ZigVersion" "zig"
Set-Content -Path (Join-Path $OutDir ".tag") -Value "$ZigVersion"
} catch {
Remove-Item -Force -ErrorAction SilentlyContinue $OutDir
throw $_
} finally {
Pop-Location
}