2023-08-24 20:41:11 +02:00
|
|
|
MKT_PROJECT_VERSION_TIMEZONE ?= Europe/Paris
|
2023-11-16 16:34:56 +01:00
|
|
|
MKT_PROJECT_VERSION_BRANCH_NAME ?= $(if $(CI), $(BRANCH_NAME), $(shell git rev-parse --abbrev-ref HEAD))
|
2023-08-24 20:41:11 +02:00
|
|
|
MKT_PROJECT_VERSION_CLEANED_BRANCH_NAME ?= $(shell echo $(MKT_PROJECT_VERSION_BRANCH_NAME) | tr '[:upper:]' '[:lower:]' | sed -e 's/[-_ ]//g')
|
2023-08-23 23:18:58 +02:00
|
|
|
|
2023-08-24 20:41:11 +02:00
|
|
|
ifeq ($(MKT_PROJECT_VERSION_CLEANED_BRANCH_NAME),master)
|
2023-08-23 23:18:58 +02:00
|
|
|
MKT_PROJECT_VERSION_CHANNEL = stable
|
2023-08-24 20:41:11 +02:00
|
|
|
else ifeq ($(MKT_PROJECT_VERSION_CLEANED_BRANCH_NAME),staging)
|
2023-08-23 23:18:58 +02:00
|
|
|
MKT_PROJECT_VERSION_CHANNEL = testing
|
|
|
|
else
|
2023-08-24 20:41:11 +02:00
|
|
|
MKT_PROJECT_VERSION_CHANNEL = $(MKT_PROJECT_VERSION_CLEANED_BRANCH_NAME)
|
2023-08-23 23:18:58 +02:00
|
|
|
endif
|
|
|
|
|
2023-08-23 19:54:18 +02:00
|
|
|
|
|
|
|
ifeq ($(MKT_PROJECT_VERSION_CHANNEL),develop)
|
|
|
|
MKT_PROJECT_SHORT_VERSION_CHANNEL ?= dev
|
2023-08-23 23:18:58 +02:00
|
|
|
else ifneq ($(filter $(MKT_PROJECT_VERSION_CHANNEL),testing staging),)
|
2023-08-23 19:54:18 +02:00
|
|
|
MKT_PROJECT_SHORT_VERSION_CHANNEL ?= tst
|
2023-08-23 23:18:58 +02:00
|
|
|
else ifneq ($(filter $(MKT_PROJECT_VERSION_CHANNEL),stable master),)
|
2023-08-23 19:54:18 +02:00
|
|
|
MKT_PROJECT_SHORT_VERSION_CHANNEL ?= stb
|
|
|
|
else
|
2024-02-23 12:31:01 +01:00
|
|
|
MKT_PROJECT_SHORT_VERSION_CHANNEL ?= $(MKT_PROJECT_VERSION_CHANNEL)
|
2023-08-23 19:54:18 +02:00
|
|
|
endif
|
|
|
|
|
2023-08-24 15:58:54 +02:00
|
|
|
MKT_PROJECT_VERSION_COMMIT_TIMESTAMP ?= $(shell git show -s --format=%ct)
|
2023-08-24 20:41:11 +02:00
|
|
|
MKT_PROJECT_VERSION_DATE ?= $(shell TZ=$(MKT_PROJECT_VERSION_TIMEZONE) date -d '@$(MKT_PROJECT_VERSION_COMMIT_TIMESTAMP)' +%Y.%-m.%-d)
|
|
|
|
MKT_PROJECT_VERSION_TIMESTAMP ?= $(shell TZ=$(MKT_PROJECT_VERSION_TIMEZONE) date -d '@$(MKT_PROJECT_VERSION_COMMIT_TIMESTAMP)' +%-H%M)
|
2023-08-23 19:54:18 +02:00
|
|
|
|
2023-11-15 13:51:44 +01:00
|
|
|
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)
|
|
|
|
|
|
|
|
export MKT_PROJECT_VERSION
|
|
|
|
export MKT_PROJECT_SHORT_VERSION
|
2023-08-23 23:18:58 +02:00
|
|
|
|
|
|
|
.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)
|