Commit ef8d9e13 by Chavee Issariyapat

Update Makefile to fix xxx-dirty

parent f0dc8074
# a helper shell script # a helper shell script
# version 1.1
define MAKEFUNCTIONCODE define MAKEFUNCTIONCODE
function hasChanges() { 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() { function getRelease() {
...@@ -102,7 +107,7 @@ RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.mak ...@@ -102,7 +107,7 @@ RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.mak
export MAKEFUNCTIONCODE export MAKEFUNCTIONCODE
.PHONY: pre-build docker-build post-build build release patch-release minor-release major-release tag check-status check-release showver \ .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: init:
@echo "$$MAKEFUNCTIONCODE" > ./.make-function @echo "$$MAKEFUNCTIONCODE" > ./.make-function
...@@ -117,6 +122,9 @@ post-build: ...@@ -117,6 +122,9 @@ post-build:
post-push: post-push:
@rm .make-function @rm .make-function
post-init:
@rm .make-function
docker-build: docker-build:
docker build -t $(IMAGE):$(VERSION) . docker build -t $(IMAGE):$(VERSION) .
@DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \ @DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \
...@@ -173,8 +181,9 @@ tag: check-status ...@@ -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 @ if [ -n "$(shell git remote -v)" ] ; then git push --tags ; else echo 'no remote to push tags to' ; fi
check-status: init 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) ; 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) @. $(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