Makefile: add v prefix to version read from VERSION file

Previous I added the prefix directly in `docker-image` target.
But that doesn't make sense if you override the `RELEASE_TAG`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-01-26 18:12:24 +01:00 committed by Jakub
parent e433e7d470
commit 98d48dcfd0
1 changed files with 10 additions and 10 deletions

View File

@ -1,7 +1,7 @@
.PHONY: statusgo statusd-prune all test clean help .PHONY: statusgo statusd-prune all test clean help
.PHONY: statusgo-android statusgo-ios .PHONY: statusgo-android statusgo-ios
RELEASE_TAG := $(shell cat VERSION) RELEASE_TAG := v$(shell cat VERSION)
RELEASE_BRANCH := develop RELEASE_BRANCH := develop
RELEASE_DIR := /tmp/release-$(RELEASE_TAG) RELEASE_DIR := /tmp/release-$(RELEASE_TAG)
PRE_RELEASE := "1" PRE_RELEASE := "1"
@ -35,11 +35,11 @@ AUTHOR = $(shell echo $$USER)
ENABLE_METRICS ?= true ENABLE_METRICS ?= true
BUILD_FLAGS ?= $(shell echo "-ldflags='\ BUILD_FLAGS ?= $(shell echo "-ldflags='\
-X github.com/status-im/status-go/params.Version=$(RELEASE_TAG) \ -X github.com/status-im/status-go/params.Version=$(RELEASE_TAG:v%=%) \
-X github.com/status-im/status-go/params.GitCommit=$(GIT_COMMIT) \ -X github.com/status-im/status-go/params.GitCommit=$(GIT_COMMIT) \
-X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=$(ENABLE_METRICS)'") -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=$(ENABLE_METRICS)'")
BUILD_FLAGS_MOBILE ?= $(shell echo "-ldflags='\ BUILD_FLAGS_MOBILE ?= $(shell echo "-ldflags='\
-X github.com/status-im/status-go/params.Version=$(RELEASE_TAG) \ -X github.com/status-im/status-go/params.Version=$(RELEASE_TAG:v%=%) \
-X github.com/status-im/status-go/params.GitCommit=$(GIT_COMMIT)'") -X github.com/status-im/status-go/params.GitCommit=$(GIT_COMMIT)'")
networkid ?= StatusChain networkid ?= StatusChain
@ -151,7 +151,7 @@ docker-image: ##@docker Build docker image (use DOCKER_IMAGE_NAME to set the ima
--build-arg "build_flags=$(BUILD_FLAGS)" \ --build-arg "build_flags=$(BUILD_FLAGS)" \
--label "commit=$(GIT_COMMIT)" \ --label "commit=$(GIT_COMMIT)" \
--label "author=$(AUTHOR)" \ --label "author=$(AUTHOR)" \
-t $(DOCKER_IMAGE_NAME):v$(DOCKER_IMAGE_CUSTOM_TAG) \ -t $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG) \
-t $(DOCKER_IMAGE_NAME):latest -t $(DOCKER_IMAGE_NAME):latest
bootnode-image: bootnode-image:
@ -161,7 +161,7 @@ bootnode-image:
--build-arg "build_flags=$(BUILD_FLAGS)" \ --build-arg "build_flags=$(BUILD_FLAGS)" \
--label "commit=$(GIT_COMMIT)" \ --label "commit=$(GIT_COMMIT)" \
--label "author=$(AUTHOR)" \ --label "author=$(AUTHOR)" \
-t $(BOOTNODE_IMAGE_NAME):v$(DOCKER_IMAGE_CUSTOM_TAG) \ -t $(BOOTNODE_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG) \
-t $(BOOTNODE_IMAGE_NAME):latest -t $(BOOTNODE_IMAGE_NAME):latest
push-docker-images: docker-image bootnode-image push-docker-images: docker-image bootnode-image
@ -186,8 +186,8 @@ ifneq ("$(GIT_LOCAL)", "$(GIT_REMOTE)")
$(error The local git commit does not match the remote origin!) $(error The local git commit does not match the remote origin!)
exit 1 exit 1
endif endif
docker push $(BOOTNODE_IMAGE_NAME):v$(DOCKER_IMAGE_CUSTOM_TAG) docker push $(BOOTNODE_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG)
docker push $(DOCKER_IMAGE_NAME):v$(DOCKER_IMAGE_CUSTOM_TAG) docker push $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG)
install-os-dependencies: install-os-dependencies:
_assets/scripts/install_deps.sh _assets/scripts/install_deps.sh
@ -225,8 +225,8 @@ lint-fix:
$(MAKE) vendor $(MAKE) vendor
check-existing-release: check-existing-release:
@git ls-remote --exit-code origin "v$(RELEASE_TAG)" >/dev/null || exit 0; \ @git ls-remote --exit-code origin "$(RELEASE_TAG)" >/dev/null || exit 0; \
echo "$(YELLOW)Release tag already exists: v$(RELEASE_TAG)$(RESET)"; \ echo "$(YELLOW)Release tag already exists: $(RELEASE_TAG)$(RESET)"; \
echo "Remove the tag/release if you want to re-create it."; \ echo "Remove the tag/release if you want to re-create it."; \
exit 1; exit 1;
@ -240,7 +240,7 @@ release: check-existing-release
github-release \ github-release \
$(shell if [ $(PRE_RELEASE) != "0" ] ; then echo "-prerelease" ; fi) \ $(shell if [ $(PRE_RELEASE) != "0" ] ; then echo "-prerelease" ; fi) \
"status-im/status-go" \ "status-im/status-go" \
"v$(RELEASE_TAG)" \ "$(RELEASE_TAG)" \
"$(RELEASE_BRANCH)" \ "$(RELEASE_BRANCH)" \
"$(changelog)" \ "$(changelog)" \
"$(RELEASE_DIR)/*" ; \ "$(RELEASE_DIR)/*" ; \