Commit ef8d9e13 by Chavee Issariyapat

Update Makefile to fix xxx-dirty

parent f0dc8074
# a helper shell script
# version 1.1
define MAKEFUNCTIONCODE
function hasChanges() {
test -n "$$(git status -s .)"
# old version, just track uncommited + untracked files
# test -n "$$(git status -s .)"
# expect 1 to be normal so the untracked file .make-funcition will be ignored
test 1 -ne "$$(git status -s . | wc -l )"
}
function getRelease() {
......@@ -102,7 +107,7 @@ RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.mak
export MAKEFUNCTIONCODE
.PHONY: pre-build docker-build post-build build release patch-release minor-release major-release tag check-status check-release showver \
push do-push post-push
push do-push post-push post-init
init:
@echo "$$MAKEFUNCTIONCODE" > ./.make-function
......@@ -117,6 +122,9 @@ post-build:
post-push:
@rm .make-function
post-init:
@rm .make-function
docker-build:
docker build -t $(IMAGE):$(VERSION) .
@DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \
......@@ -173,8 +181,9 @@ tag: check-status
@ if [ -n "$(shell git remote -v)" ] ; then git push --tags ; else echo 'no remote to push tags to' ; fi
check-status: init
@. $(RELEASE_SUPPORT) ; ! hasChanges || (echo "ERROR: there are still outstanding changes" >&2 && exit 1) ;
@. $(RELEASE_SUPPORT) ; ! hasChanges || (echo "ERROR: there are still outstanding changes" >&2) ;
@rm .make-function
check-release: init release.conf
check-release: init release.conf post-init
@. $(RELEASE_SUPPORT) ; tagExists $(TAG) || (echo "ERROR: version not yet tagged in git. make [minor,major,patch]-release." >&2 && exit 1) ;
@. $(RELEASE_SUPPORT) ; ! differsFromRelease $(TAG) || (echo "ERROR: current directory differs from tagged $(TAG). make [minor,major,patch]-release." ; exit 1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment