Skip to content
Snippets Groups Projects
target-git.mk 1.62 KiB
#############################################################################################
#############################################################################################
##
## GIT-TARGETS
##
#############################################################################################
#############################################################################################

EXECUTABLES = $(EXECUTABLES:-) uuidgen

## Current Branch-GIT_TAG
GIT_TAG := -

## Git Commit GIT_MESSAGE for git-push
GIT_MESSAGE := current status

.PHONY: git-branch
## create new branch (use GIT_TAG-Variable)
git-branch:

	$(QUIET) export BRANCH="b$(GIT_TAG)/$(shell uuidgen --random)" ; \
	$(GIT) checkout -b $${BRANCH} && \
	RESULT=$$($(GIT) push origin $$BRANCH 2>&1) && \
    RESULT2=$$($(GIT) branch --set-upstream-to=origin/$$BRANCH $$BRANCH) && \
	GITLABURL=$$(echo "$$RESULT" | tr '\n' '\#' | grep -o 'remote\:\s*https:\/\/gitlab\.schukai\.com[^ ]*' | cut -d " " -f2-9 | sed -e 's/^[ \t]*//') && \
	if $(OPENBROWSER) ; then google-chrome --profile-directory="Default" $$GITLABURL ; fi

.PHONY: git-to-master
## git checkout master, fetch and merge
git-to-master:
	$(GIT) checkout master && $(GIT) fetch -pP && $(GIT) merge

.PHONY: git-push-to-server
## git push changes to server
git-push-to-server:
	$(QUIET) $(GIT) add -A
	$(QUIET) $(GIT) commit -m"$(GIT_MESSAGE)"
	$(QUIET) $(GIT) push

.PHONY: git-push
## git create branch and push changes to server
git-push: git-branch git-push-to-server

.PHONY: git-GIT_TAG
## git create version GIT_TAG
git-GIT_TAG:
	$(QUIET) $(GIT) GIT_TAG -a "$(COMPONENT_VERSION)" -m "release $(COMPONENT_VERSION)"