build: add one more version check

This commit is contained in:
Daylin Morgan 2023-01-20 12:45:36 -06:00
parent e32279d494
commit 8cc34dbcde
1 changed files with 4 additions and 2 deletions

View File

@ -44,8 +44,10 @@ c clean: ## remove the generated files
@rm -f task.mk .task.mk
define version_check_sh
if [[ "${VERSION}" == *'-'* ]]; then
$(call tprint-verbose,{a.red}VERSION INVALID!{a.end} Uncommited or untagged work)
if git rev-parse -q --verify "refs/tags/${VERSION}" >/dev/null; then
$(call tprint-verbose,{a.red}VERSION INVALID!{a.end} tag already exists); exit 1;
elif [[ "${VERSION}" == *'-'* ]]; then
$(call tprint-verbose,{a.red}VERSION INVALID!{a.end} Uncommited or untagged work); exit 1;
exit 1
elif [[ $(shell echo "${VERSION}" | awk -F. '{ print NF }') -lt 3 ]];then\
$(call tprint-verbose,{a.red}VERSION INVALID!{a.end} Expected CalVer string)