From 1300c57d49c4793ce6ea7e034100ab4a51136b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Wed, 2 Aug 2023 12:28:24 +0200 Subject: [PATCH] Use automatic version numbers in release builds (#216) --- .goreleaser.yaml | 11 ++++++----- cli/cli.go | 2 +- cli/version.go | 2 +- version/version.go | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 598d7abe..59fa7de2 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -16,6 +16,7 @@ builds: - goos: linux goarch: arm64 ldflags: + - -X github.com/bitrise-io/envman/version.Version={{ .Version }} - -X github.com/bitrise-io/envman/version.Commit={{ .FullCommit }} - -X github.com/bitrise-io/envman/version.BuildNumber={{ index .Env "BITRISE_BUILD_NUMBER" }} @@ -23,11 +24,11 @@ archives: # GitHub release should contain the raw binaries (no zip or tar.gz) - format: binary # Name format should match the curl install script - name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" - replacements: - darwin: Darwin - linux: Linux - amd64: x86_64 + name_template: >- + {{ .ProjectName }}- + {{- title .Os }}- + {{- if eq .Arch "amd64" }}x86_64 + {{- else }}{{ .Arch }}{{ end }} release: github: diff --git a/cli/cli.go b/cli/cli.go index 3a2453f5..20102e98 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -81,7 +81,7 @@ func Run() { app := cli.NewApp() app.Name = path.Base(os.Args[0]) app.Usage = "Environment variable manager" - app.Version = version.VERSION + app.Version = version.Version app.Author = "" app.Email = "" diff --git a/cli/version.go b/cli/version.go index e206d880..d7e1127a 100644 --- a/cli/version.go +++ b/cli/version.go @@ -24,7 +24,7 @@ func printVersionCmd(c *cli.Context) error { } versionOutput := VersionOutputModel{ - Version: version.VERSION, + Version: version.Version, } if fullVersion { diff --git a/version/version.go b/version/version.go index 1ee11990..35a67e1b 100644 --- a/version/version.go +++ b/version/version.go @@ -1,4 +1,4 @@ package version -// VERSION ... -const VERSION = "2.4.0" +// Version is the main CLI version number. It's defined at build time using -ldflags +var Version = "0.99-development"