From 7165d90d2d5ff20b7293614e180f994847d36915 Mon Sep 17 00:00:00 2001 From: William Petit Date: Wed, 23 Aug 2023 15:18:58 -0600 Subject: [PATCH] feat(version): use master and staging branches as aliases for testing and stable --- tasks/version.mk | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tasks/version.mk b/tasks/version.mk index 767fbe5..02b5e94 100644 --- a/tasks/version.mk +++ b/tasks/version.mk @@ -1,10 +1,19 @@ -MKT_PROJECT_VERSION_CHANNEL ?= $(shell git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]' | sed -e 's/[-_ ]//g') +MKT_PROJECT_BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]' | sed -e 's/[-_ ]//g') + +ifeq ($(MKT_PROJECT_BRANCH_NAME),master) + MKT_PROJECT_VERSION_CHANNEL = stable +else ifeq ($(MKT_PROJECT_BRANCH_NAME),staging) + MKT_PROJECT_VERSION_CHANNEL = testing +else + MKT_PROJECT_VERSION_CHANNEL = $(MKT_PROJECT_BRANCH_NAME) +endif + ifeq ($(MKT_PROJECT_VERSION_CHANNEL),develop) MKT_PROJECT_SHORT_VERSION_CHANNEL ?= dev -else ifeq ($(MKT_PROJECT_VERSION_CHANNEL),testing) +else ifneq ($(filter $(MKT_PROJECT_VERSION_CHANNEL),testing staging),) MKT_PROJECT_SHORT_VERSION_CHANNEL ?= tst -else ifeq ($(MKT_PROJECT_VERSION_CHANNEL),stable) +else ifneq ($(filter $(MKT_PROJECT_VERSION_CHANNEL),stable master),) MKT_PROJECT_SHORT_VERSION_CHANNEL ?= stb else MKT_PROJECT_SHORT_VERSION_CHANNEL ?= $(shell echo "$(MKT_PROJECT_VERSION_CHANNEL)" | sed -e 's/[aeiouy]//g' | cut -c1-3) @@ -15,3 +24,11 @@ MKT_PROJECT_VERSION_TIMESTAMP ?= $(shell date +%-H%M) MKT_PROJECT_VERSION ?= $(MKT_PROJECT_VERSION_DATE)-$(MKT_PROJECT_VERSION_CHANNEL).$(MKT_PROJECT_VERSION_TIMESTAMP).$(shell git rev-parse --short HEAD) MKT_PROJECT_SHORT_VERSION ?= $(MKT_PROJECT_VERSION_DATE)-$(MKT_PROJECT_SHORT_VERSION_CHANNEL).$(MKT_PROJECT_VERSION_TIMESTAMP) + +.PHONY: mkt-project-version +mkt-project-version: + @echo $(MKT_PROJECT_VERSION) + +.PHONY: mkt-project-short-version +mkt-project-short-version: + @echo $(MKT_PROJECT_SHORT_VERSION) \ No newline at end of file