Skip to content

Commit

Permalink
Fixing version and tag vars in make.
Browse files Browse the repository at this point in the history
  • Loading branch information
dopey committed Apr 10, 2020
1 parent 80d074a commit 2cc67b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
25 changes: 24 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,34 @@ all: build lint test

.PHONY: all

# Version flags to embed in the binaries
#################################################
# Determine the type of `push` and `version`
#################################################

# If TRAVIS_TAG is set then we know this ref has been tagged.
ifdef TRAVIS_TAG
VERSION := $(TRAVIS_TAG)
NOT_RC := $(shell echo $(VERSION) | grep -v -e -rc)
ifeq ($(NOT_RC),)
PUSHTYPE := release-candidate
else
PUSHTYPE := release
endif
else
VERSION ?= $(shell [ -d .git ] && git describe --tags --always --dirty="-dev")
# If we are not in an active git dir then try reading the version from .VERSION.
# .VERSION contains a slug populated by `git archive`.
VERSION := $(or $(VERSION),$(shell ./.version.sh .VERSION))
PUSHTYPE := master
endif

VERSION := $(shell echo $(VERSION) | sed 's/^v//')

ifdef V
$(info TRAVIS_TAG is $(TRAVIS_TAG))
$(info VERSION is $(VERSION))
$(info PUSHTYPE is $(PUSHTYPE))
endif

include make/common.mk
include make/docker.mk
Expand Down
19 changes: 0 additions & 19 deletions make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,6 @@ bootstra%:

.PHONY: bootstra%

#################################################
# Determine the type of `push` and `version`
#################################################

# If TRAVIS_TAG is set then we know this ref has been tagged.
ifdef TRAVIS_TAG
VERSION := $(TRAVIS_TAG)
NOT_RC := $(shell echo $(VERSION) | grep -v -e -rc)
ifeq ($(NOT_RC),)
PUSHTYPE=release-candidate
else
PUSHTYPE=release
endif
else
VERSION ?= $(shell [ -d .git ] && git describe --tags --always --dirty="-dev")
VERSION := $(shell echo $(VERSION) | sed 's/^v//')
PUSHTYPE=master
endif

#########################################
# Build
#########################################
Expand Down

0 comments on commit 2cc67b8

Please sign in to comment.