-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbuild.ps1
More file actions
22 lines (17 loc) · 815 Bytes
/
Copy pathbuild.ps1
File metadata and controls
22 lines (17 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ErrorActionPreference = "Stop"
# Get version info
$version = git describe --tags --always --dirty
$commit = git rev-parse HEAD
$buildTime = Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ"
# Create bin directory if it doesn't exist
if (-not (Test-Path -Path "bin")) {
New-Item -ItemType Directory -Path "bin" | Out-Null
}
# Build the application
$ldflags = "-X 'github.com/opendataensemble/synkronus/pkg/version.version=$version' " +
"-X 'github.com/opendataensemble/synkronus/pkg/version.commit=$commit' " +
"-X 'github.com/opendataensemble/synkronus/pkg/version.buildTime=$buildTime'"
go build -ldflags="$ldflags" -o bin/synkronus.exe cmd/synkronus/main.go
if ($LASTEXITCODE -eq 0) {
Write-Host "Build successful! Output: bin/synkronus.exe" -ForegroundColor Green
}