Skip to content

Commit

Permalink
Adding empty var protection
Browse files Browse the repository at this point in the history
incorrect or empty SEMVAR values when needed will stop with an eror.
  • Loading branch information
Stephen James committed Dec 6, 2023
1 parent 7055114 commit d466f4e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ current_version: ## Get current version eg v3.4.1

.PHONY: preview_version
preview_version: ## increment version eg v3.4.1 > v3.5.0. Use SEMVAR=[ patch | minor | major ]
ifeq ($(filter $(SEMVAR), patch minor major),)
$(error invalid `SEMVAR` value)
endif
@echo "CURRENT_VERSION := $(CURRENT_VERSION)"
@echo "$(SEMVAR) := $(NEXT_VERSION)"

Expand All @@ -44,6 +47,9 @@ preview_name: ## view container name

.PHONY: tag
tag: ## Tag branch in git repo with next version number. Use SEMVAR=[ patch | minor | major ]
ifeq ($(filter $(SEMVAR), patch minor major),)
$(error invalid `SEMVAR` value)
endif
@echo "tagging with $(NEXT_VERSION)"
@git tag -a "$(NEXT_VERSION)" -m "Bump from $(CURRENT_VERSION) to $(NEXT_VERSION)"
@git push origin main --follow-tags
Expand Down

0 comments on commit d466f4e

Please sign in to comment.