Improve Makefile (#1275)

* change docker image tag to RELEASE_TAG
* use changelog in release
This commit is contained in:
Adam Babik 2018-11-20 11:13:42 +01:00 committed by GitHub
parent d3c8079075
commit e658366d1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions

View File

@ -32,15 +32,14 @@ endif
CGO_CFLAGS = -I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin CGO_CFLAGS = -I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin
GOBIN = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin GOBIN = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin
GIT_COMMIT = $(shell tag=`git describe --exact-match --tag 2>/dev/null`; \ GIT_COMMIT = $(shell git rev-parse --short HEAD)
if [ $$? -eq 0 ]; then echo $$tag | sed 's/^v\(.*\)$$/\1/'; \
else git rev-parse --short HEAD; fi)
AUTHOR = $(shell echo $$USER) AUTHOR = $(shell echo $$USER)
ENABLE_METRICS ?= false ENABLE_METRICS ?= false
BUILD_FLAGS ?= $(shell echo "-ldflags '\ BUILD_FLAGS ?= $(shell echo "-ldflags '\
-X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` \ -X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` \
-X github.com/status-im/status-go/params.Version=$(GIT_COMMIT) \ -X github.com/status-im/status-go/params.Version=$(RELEASE_TAG) \
-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)'")
XGO_GO ?= latest XGO_GO ?= latest
@ -56,7 +55,7 @@ BOOTNODE_IMAGE_NAME ?= statusteam/bootnode
PROXY_IMAGE_NAME ?= statusteam/discovery-proxy PROXY_IMAGE_NAME ?= statusteam/discovery-proxy
STATUSD_PRUNE_IMAGE_NAME ?= statusteam/statusd-prune STATUSD_PRUNE_IMAGE_NAME ?= statusteam/statusd-prune
DOCKER_IMAGE_CUSTOM_TAG ?= $(GIT_COMMIT) DOCKER_IMAGE_CUSTOM_TAG ?= $(RELEASE_TAG)
DOCKER_TEST_WORKDIR = /go/src/github.com/status-im/status-go/ DOCKER_TEST_WORKDIR = /go/src/github.com/status-im/status-go/
DOCKER_TEST_IMAGE = golang:1.10 DOCKER_TEST_IMAGE = golang:1.10
@ -227,9 +226,13 @@ clean-release:
rm -rf $(RELEASE_DIRECTORY) rm -rf $(RELEASE_DIRECTORY)
release: release:
@read -p "Are you sure you want to create a new GitHub $(shell if [[ $(PRE_RELEASE) = "0" ]] ; then echo release; else echo pre-release ; fi) against $(RELEASE_BRANCH) branch? (y/n): " REPLY; \ @read -p "Are you sure you want to create a new GitHub $(shell if [ $(PRE_RELEASE) = "0" ] ; then echo release; else echo pre-release ; fi) against $(RELEASE_BRANCH) branch? (y/n): " REPLY; \
if [ $$REPLY = "y" ]; then \ if [ $$REPLY = "y" ]; then \
github-release $(shell if [[ $(PRE_RELEASE) != "0" ]] ; then echo "-prerelease" ; fi) "status-im/status-go" "$(RELEASE_TAG)" "$(RELEASE_BRANCH)" "" "$(RELEASE_DIRECTORY)/*" ; \ latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1`); \
comparison="$$latest_tag..HEAD"; \
if [ -z "$$latest_tag" ]; then comparison=""; fi; \
changelog=$$(git log $$comparison --oneline --no-merges --format="* %h %s"); \
github-release $(shell if [ $(PRE_RELEASE) != "0" ] ; then echo "-prerelease" ; fi) "status-im/status-go" "$(RELEASE_TAG)" "$(RELEASE_BRANCH)" "$(changelog)" "$(RELEASE_DIRECTORY)/*" ; \
else \ else \
echo "Aborting." && exit 1; \ echo "Aborting." && exit 1; \
fi fi

View File

@ -1,4 +1,7 @@
package params package params
// Version relies on a git tag and is passed by linker's '-ldflags' flag. // Version is defined in VERSION file.
var Version string var Version string
// GitCommit is a commit hash.
var GitCommit string