From 3883a8131511ba7affbb1e760b72689353715821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 6 Mar 2023 16:32:16 +0800 Subject: [PATCH] Check constant.Version before build release --- cmd/internal/build/main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/internal/build/main.go b/cmd/internal/build/main.go index 0bd11f98..d0b5c1f6 100644 --- a/cmd/internal/build/main.go +++ b/cmd/internal/build/main.go @@ -5,16 +5,27 @@ import ( "os/exec" "github.com/sagernet/sing-box/cmd/internal/build_shared" + C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" + "github.com/sagernet/sing/common" ) func main() { build_shared.FindSDK() + currentTag, err := common.Exec("git", "describe", "--tags", "--abbrev=0").Read() + if err != nil { + log.Fatal(err) + } + + if "v"+C.Version != currentTag { + log.Fatal("version mismatch, update constant.Version to ", currentTag[1:]) + } + command := exec.Command(os.Args[1], os.Args[2:]...) command.Stdout = os.Stdout command.Stderr = os.Stderr - err := command.Run() + err = command.Run() if err != nil { log.Fatal(err) }