variable "version" {
type = string
}
computed "current_os" {
description = "Current operating system"
expression = os()
}
computed "archive_ext" {
description = "Platform-appropriate archive extension"
expression = computed.current_os == "windows" ? ".zip" : ".tar.gz"
}
task "package" {
description = "Build and archive the binary for the current platform"
commands = [
"go build -o bin/app${computed.current_os == "windows" ? ".exe" : ""} ./cmd/app",
"tar -czf app-${var.version}-${computed.current_os}.tar.gz bin/",
]
}