Skip to content
Snippets Groups Projects
Select Git revision
  • 5b9aa060ef465c17afbd2a505ae28dd6b2daf221
  • master default protected
  • v0.4.7
  • v0.4.6
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.0
  • v0.2.1
  • v0.2.0
13 results

target-version.mk

Blame
  • Volker Schukai's avatar
    5b9aa060
    History
    target-version.mk 3.63 KiB
    #############################################################################################
    #############################################################################################
    ##
    ## VARIABLES-TARGETS
    ##
    #############################################################################################
    #############################################################################################
    
    ifeq ($(VERSION_BIN),) 
      $(error "$(VERSION_BIN) is not installed. Please check your makefile and include the version.mk")
    endif
    
    ifeq ($(GIT),)
      $(error $(ERRORMARKER) Git is not defined, check your Makefile if git.mk is included)
    endif
    
    ifeq ($(GIT_CHGLOG_BIN),)
      $(error $(ERRORMARKER) Chglog is not defined, check your Makefile if changelog.mk is included)
    endif
    
    $(VERSION_BIN):
    	$(QUIET) $(MKDIR) -p $(VENDOR_PATH)
    	$(QUIET) $(WGET) -O $(VERSION_BIN) http://download.schukai.com/tools/version/version-$(shell uname -s | tr [:upper:] [:lower:])-$(shell echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`)
    	$(QUIET) $(CHMOD) u+x $(VERSION_BIN)
    
    
    .PHONY: next-patch-version
    next-patch-version: check-clean-repo $(VERSION_BIN)
    	$(ECHOMARKER)  "Creating next version"
    	$(QUIET) $(VERSION_BIN) patch --path $(RELEASE_FILE) --selector "version"
    	$(QUIET) $(GIT) add $(RELEASE_FILE) && $(GIT) commit -m "Bump version to $$(cat $(RELEASE_FILE) | jq -r .version)"
    
    .PHONY: next-minor-version
    next-minor-version: check-clean-repo $(VERSION_BIN)
    	$(ECHOMARKER)   "Creating next minor version"
    	$(QUIET) $(VERSION_BIN) minor --path $(RELEASE_FILE) --selector "version"
    	$(QUIET) $(GIT) add $(RELEASE_FILE) && $(GIT) commit -m "Bump version to $$( cat $(RELEASE_FILE) | jq -r .version)"
    
    .PHONY: next-major-version
    next-major-version: check-clean-repo $(VERSION_BIN)
    	$(ECHOMARKER)  "Creating next minor version"
    	$(QUIET) $(VERSION_BIN) major --path $(RELEASE_FILE) --selector "version"
    	$(QUIET) $(GIT) add $(RELEASE_FILE) && $(GIT) commit -m "Bump version to $$(cat $(RELEASE_FILE) | jq -r .version)"
    
    .PHONY: check-clean-repo
    check-clean-repo:
    	$(QUIET) $(GIT) diff-index --quiet HEAD || (echo "There are uncommitted changes after running make. Please commit or stash them before running make."; exit 1)
    	
    ## tag repository with next patch version
    tag-patch-version: $(GIT_CHGLOG_CONFIG_DIR)/config.yml $(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md next-patch-version 
    	$(ECHOMARKER)  "Tagging patch version"
    	$(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
    	$(GIT_CHGLOG_BIN) --next-tag v$(PROJECT_VERSION) -o $(CHANGELOG_FILE)
    	$(QUIET) $(GIT) add $(CHANGELOG_FILE) && $(GIT) commit -m "Update changelog"
    	$(QUIET) $(GIT) tag -a v$(PROJECT_VERSION) -m "Version $(PROJECT_VERSION)"
    
    ## tag repository with next minor version
    tag-minor-version: $(GIT_CHGLOG_CONFIG_DIR)/config.yml $(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md next-minor-version 
    	$(ECHOMARKER)  "Tagging minor version"
    	$(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
    	$(GIT_CHGLOG_BIN) --next-tag v$(PROJECT_VERSION) -o $(CHANGELOG_FILE)
    	$(QUIET) $(GIT) add $(CHANGELOG_FILE) && $(GIT) commit -m "Update changelog"
    	$(QUIET) $(GIT) tag -a v$(PROJECT_VERSION) -m "Version $(PROJECT_VERSION)"
    
    ## tag repository with next major version
    tag-major-version: $(GIT_CHGLOG_CONFIG_DIR)/config.yml $(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md next-major-version 
    	$(ECHOMARKER)  "Tagging major version"
    	$(eval PROJECT_VERSION := $(shell cat $(RELEASE_FILE) | jq -r .version))
    	$(GIT_CHGLOG_BIN) --next-tag v$(PROJECT_VERSION) -o $(CHANGELOG_FILE)
    	$(QUIET) $(GIT) add $(CHANGELOG_FILE) && $(GIT) commit -m "Update changelog"
    	$(QUIET) $(GIT) tag -a v$(PROJECT_VERSION) -m "Version $(PROJECT_VERSION)"