Renamed from arcdb: module path, cmd/archer, internal/archererr, docs, build scripts and ARCHER_* environment variables. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25 lines
984 B
PowerShell
25 lines
984 B
PowerShell
param(
|
|
[string]$Version = "0.1.0",
|
|
[string]$Commit = $(if ($env:ARCHER_COMMIT) { $env:ARCHER_COMMIT } else { "local" })
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$date = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
|
|
$ldflags = "-s -w -X archer/internal/version.Version=$Version -X archer/internal/version.Commit=$Commit -X archer/internal/version.Date=$date"
|
|
|
|
New-Item -ItemType Directory -Force -Path (Join-Path $root "dist") | Out-Null
|
|
Push-Location $root
|
|
try {
|
|
go build -trimpath -ldflags $ldflags -o dist/archer_windows_amd64.exe ./cmd/archer
|
|
$env:GOOS = "linux"
|
|
$env:GOARCH = "amd64"
|
|
go build -trimpath -ldflags $ldflags -o dist/archer_linux_amd64 ./cmd/archer
|
|
Remove-Item Env:GOOS -ErrorAction SilentlyContinue
|
|
Remove-Item Env:GOARCH -ErrorAction SilentlyContinue
|
|
Write-Host "built dist/archer_windows_amd64.exe and dist/archer_linux_amd64 ($Version, $Commit)"
|
|
}
|
|
finally {
|
|
Pop-Location
|
|
}
|