From 6dba2eb6de8e2277c9c73b0655f9b9d490f3a775 Mon Sep 17 00:00:00 2001 From: Carsten Seeger Date: Mon, 18 Dec 2023 13:21:52 +0100 Subject: [PATCH] fix: magefile release build --- magefile.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/magefile.go b/magefile.go index 53c2873..07fb9fc 100644 --- a/magefile.go +++ b/magefile.go @@ -69,7 +69,9 @@ func CreateRelease() error { return err } - err = sh.RunV("go", "build", "-a", "-tags", "netgo", "-o", path+binName, "-ldflags", "-w -extldflags \"-static\"") + tag, _ := exec.Command("bash", "-c", "git tag --sort=-version:refname | head -n 1").Output() + + err = sh.RunV("go", "build", "-a", "-tags", "netgo", "-o", path+binName, "-ldflags", "-w -extldflags \"-static\" -X 'main.Version="+string(tag)+"'") if err != nil { return err }