feat: add build-stamped version with --version flag and TUI header
Introduce tui.Version (defaults to "dev"), stamped at build time via a VERSION_LDFLAG in the Makefile (-X .../internal/tui.Version=$(VERSION)) across all build targets. main.go handles "--version"/"-v" before launching the TUI, and the version is shown next to the title in the header. Docs updated (README + CLAUDE). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,33 +1,36 @@
|
||||
.PHONY: build clean push release help
|
||||
|
||||
VERSION ?= 1.0.0
|
||||
S3_BUCKET ?=
|
||||
S3_BUCKET ?=
|
||||
BINARY_NAME ?= installer
|
||||
BUILD_DIR := ./dist
|
||||
|
||||
MODULE := git.davinti.com.br/davinTI/app-dono/tui
|
||||
VERSION_LDFLAG := -X $(MODULE)/internal/tui.Version=$(VERSION)
|
||||
|
||||
ARCHS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64
|
||||
|
||||
build: $(addprefix $(BUILD_DIR)/$(BINARY_NAME)-, $(subst /,-,$(ARCHS)))
|
||||
|
||||
$(BUILD_DIR)/$(BINARY_NAME)-linux-amd64:
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-extldflags -static" -o $@ ./cmd
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-extldflags -static $(VERSION_LDFLAG)" -o $@ ./cmd
|
||||
|
||||
$(BUILD_DIR)/$(BINARY_NAME)-linux-arm64:
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-extldflags -static" -o $@ ./cmd
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-extldflags -static $(VERSION_LDFLAG)" -o $@ ./cmd
|
||||
|
||||
$(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64:
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $@ ./cmd
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$(VERSION_LDFLAG)" -o $@ ./cmd
|
||||
|
||||
$(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64:
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o $@ ./cmd
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$(VERSION_LDFLAG)" -o $@ ./cmd
|
||||
|
||||
$(BUILD_DIR)/$(BINARY_NAME)-windows-amd64:
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $@ ./cmd
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="$(VERSION_LDFLAG)" -o $@ ./cmd
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
Reference in New Issue
Block a user