From e2c696aacf1608fdb579457ab76f4566dd1768bf Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Wed, 20 Apr 2022 20:11:52 +0200 Subject: [PATCH] try to add version to goreleaseR Signed-off-by: Chmouel Boudjnah --- .goreleaser.yml | 5 ++++- Makefile | 4 +++- gosmee.go | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 48573cb..3ab56a4 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,3 +1,7 @@ +before: + hooks: + - /bin/sh -c "echo {{.Tag}} > misc/version" + builds: - env: - CGO_ENABLED=0 @@ -40,7 +44,6 @@ brews: (zsh_completion/"_gosmee").write output prefix.install_metafiles - checksum: name_template: "checksums.txt" diff --git a/Makefile b/Makefile index 17b0742..68275e3 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ TARGET_URL ?= http://localhost:8080 SMEE_URL ?= https://smee.io/new MD_FILES := $(shell find . -type f -regex ".*md" -not -regex '^./vendor/.*' -not -regex '^./.vale/.*' -not -regex "^./.git/.*" -print) +LDFLAGS := -s -w +FLAGS += -ldflags "$(LDFLAGS)" all: test lint build @@ -14,7 +16,7 @@ clean: build: clean @echo "building." @mkdir -p bin/ - @go build -v -ldflags="-s -w" -o bin/gosmee gosmee.go + @go build -v $(FLAGS) -o bin/gosmee gosmee.go lint: lint-go lint-md diff --git a/gosmee.go b/gosmee.go index 195dc67..f6b5671 100644 --- a/gosmee.go +++ b/gosmee.go @@ -29,6 +29,9 @@ var shellScriptTmpl []byte //go:embed misc/zsh_completion.zsh var zshCompletion []byte +//go:embed misc/version +var Version []byte + //go:embed misc/bash_completion.bash var bashCompletion []byte @@ -272,6 +275,7 @@ func main() { Name: "gosmee", Usage: "forward smee url to local", EnableBashCompletion: true, + Version: string(Version), Commands: []*cli.Command{ { Name: "completion",