-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
129 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Parameters | ||
$targets = "darwin", "linux", "windows" | ||
$arch = "amd64" | ||
$appName = "tlama" | ||
|
||
# Command-Line Version Argument | ||
$version = $args[0] | ||
if (-not $version) { | ||
Write-Output "Error: Please provide a version number as a command-line argument." | ||
exit 1 | ||
} | ||
|
||
# Housekeeping | ||
Remove-Item -Recurse -Force "dist" -ErrorAction SilentlyContinue | ||
New-Item -ItemType Directory -Path "dist" | ||
|
||
# Build Function (Helper) | ||
Function Build-Target($os, $version) { | ||
$outputName = "${appName}_${version}_${os}_${arch}" | ||
if ($os -eq "windows") { | ||
$outputName += ".exe" | ||
} | ||
|
||
Write-Output "Building for $os/$arch (version: $version) -> $outputName" | ||
# Invokes the Go toolchain (assumes it's in the PATH) | ||
go build -o "dist/$version/$outputName" "cmd/cli.go" | ||
} | ||
|
||
# Build for each target OS | ||
foreach ($os in $targets) { | ||
$env:GOOS = $os | ||
$env:GOARCH = $arch | ||
$env:CGO_ENABLED = "0" | ||
Build-Target $os $version | ||
} | ||
|
||
Write-Output "Done!" |
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
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
Oops, something went wrong.