- ci-build.sh for parity with gostations (Linux Build step in workflow) - scripts/gralculator-install.sh and .ps1 modeled directly on gostations (platform detection, download, checksum verify with sha256sum/shasum, extract, install to ~/.local/bin, versioned) - Updated build.yml: Linux Build now calls ./ci-build.sh; added lint job (golangci-lint-action@v7 v2.1.6 like grokkit) after test, build now needs [test, lint] - release.yml already prepared to include the scripts if present - All modeled closely on gostations/grokkit for consistency
50 lines
1.7 KiB
PowerShell
50 lines
1.7 KiB
PowerShell
param(
|
|
[string]$Version = $env:VERSION
|
|
)
|
|
|
|
if (-not $Version) {
|
|
Write-Error "Provide -Version or set VERSION env var, e.g. VERSION=0.1.0"
|
|
exit 1
|
|
}
|
|
|
|
$Version = $Version.TrimStart('v')
|
|
|
|
$GITEA_BASE = "https://repos.gmgauthier.com/gmgauthier/galculator"
|
|
|
|
$OS = if ($IsWindows) { "windows" } elseif ($IsMacOS) { "darwin" } else { "linux" }
|
|
$ARCH = if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "X64") { "amd64" } else { "arm64" }
|
|
|
|
$ASSET = "gralculator-$OS-$ARCH-v$Version.tar.gz"
|
|
|
|
Write-Host "Installing gralculator $Version for $OS/$ARCH..."
|
|
|
|
$tempDir = New-TemporaryFile | % { rm $_; mkdir $_ }
|
|
try {
|
|
Push-Location $tempDir
|
|
|
|
Write-Host "Downloading $ASSET..."
|
|
Invoke-WebRequest -Uri "$GITEA_BASE/releases/download/v$Version/$ASSET" -OutFile "asset.tar.gz"
|
|
|
|
Write-Host "Downloading checksums.txt..."
|
|
Invoke-WebRequest -Uri "$GITEA_BASE/releases/download/v$Version/checksums.txt" -OutFile "checksums.txt"
|
|
|
|
# Extract (tar on Windows via tar if available, or 7z, but assume tar in modern PS)
|
|
Write-Host "Extracting..."
|
|
tar -xzf asset.tar.gz
|
|
|
|
$binary = "gralculator-$OS-$ARCH"
|
|
if ($OS -eq "windows") { $binary += ".exe" }
|
|
|
|
$installDir = "$HOME\.local\bin"
|
|
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
|
|
|
|
Move-Item -Force $binary "$installDir\gralculator.exe" -ErrorAction SilentlyContinue
|
|
Move-Item -Force $binary "$installDir\gralculator" -ErrorAction SilentlyContinue
|
|
|
|
Write-Host "✅ gralculator $Version installed to $installDir\gralculator"
|
|
& "$installDir\gralculator" -v
|
|
} finally {
|
|
Pop-Location
|
|
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
|
|
}
|