diff --git a/.goreleaser.yml b/.goreleaser.yml index e09ff4f7..51d5da2d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,7 +16,7 @@ builds: - CGO_ENABLED=0 ldflags: # .Env.TM_VERSION is provided in the workflow runner environment -> see .github/workflows/release.yml - - -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=atomone -X github.com/cosmos/cosmos-sdk/version.AppName=atomeond -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger -X github.com/tendermint/tendermint/version.TMCoreSemVer={{ .Env.TM_VERSION }} + - -X github.com/cosmos/cosmos-sdk/version.Name=atomone -X github.com/cosmos/cosmos-sdk/version.AppName=atomoned -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger -X github.com/cometbft/cometbft/version.TMCoreSemVer={{ .Env.TM_VERSION }} -w -s goos: - darwin - linux @@ -50,7 +50,7 @@ checksum: algorithm: sha256 snapshot: - name_template: SNAPSHOT-{{ .Commit }} + name_template: "{{ .Version }}-{{ .ShortCommit }}" changelog: skip: false diff --git a/Makefile b/Makefile index de9673e6..7ba594f0 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,15 @@ #!/usr/bin/make -f -BRANCH := $(shell git rev-parse --abbrev-ref HEAD) COMMIT := $(shell git log -1 --format='%H') # don't override user values ifeq (,$(VERSION)) - VERSION := $(shell git describe --exact-match 2>/dev/null) + VERSION := $(shell git describe --tags --exact-match 2>/dev/null) # if VERSION is empty, then populate it with branch's name and raw commit hash ifeq (,$(VERSION)) - VERSION := $(BRANCH)-$(COMMIT) + PREVIOUS_TAG := $(shell git describe --tags --abbrev=0) + SHORT_COMMIT := $(shell git rev-parse --short HEAD) + VERSION := $(PREVIOUS_TAG)-$(SHORT_COMMIT) endif endif @@ -24,6 +25,7 @@ GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' REQUIRE_GO_VERSION = 1.21 export GO111MODULE = on +export CGO_ENABLED = 0 # process build tags @@ -68,7 +70,7 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=atomone \ -X github.com/cosmos/cosmos-sdk/version.AppName=atomoned \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ - -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \ + -X github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep) \ -X github.com/cometbft/cometbft/version.TMCoreSemVer=$(TM_VERSION) ifeq (cleveldb,$(findstring cleveldb,$(ATOMONE_BUILD_OPTIONS))) @@ -97,7 +99,7 @@ include contrib/devtools/Makefile check_version: ifneq ($(GO_SYSTEM_VERSION), $(REQUIRE_GO_VERSION)) - @echo "ERROR: Go version 1.21 is required for $(VERSION) of AtomOne." + @echo "ERROR: Go version $(REQUIRE_GO_VERSION) is required for $(VERSION) of AtomOne." endif all: install lint run-tests test-e2e vulncheck