From 5a0e3edc8e7dee9869c045ae59894473c72190a7 Mon Sep 17 00:00:00 2001 From: William Petit Date: Thu, 24 Aug 2023 07:58:54 -0600 Subject: [PATCH] feat(version): use commit timestamp to generate project version --- tasks/version.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/version.mk b/tasks/version.mk index 02b5e94..c6d3631 100644 --- a/tasks/version.mk +++ b/tasks/version.mk @@ -19,8 +19,9 @@ else MKT_PROJECT_SHORT_VERSION_CHANNEL ?= $(shell echo "$(MKT_PROJECT_VERSION_CHANNEL)" | sed -e 's/[aeiouy]//g' | cut -c1-3) endif -MKT_PROJECT_VERSION_DATE ?= $(shell date +%Y.%-m.%-d) -MKT_PROJECT_VERSION_TIMESTAMP ?= $(shell date +%-H%M) +MKT_PROJECT_VERSION_COMMIT_TIMESTAMP ?= $(shell git show -s --format=%ct) +MKT_PROJECT_VERSION_DATE ?= $(shell TZ=Europe/Paris date -d '@$(MKT_PROJECT_VERSION_COMMIT_TIMESTAMP)' +%Y.%-m.%-d) +MKT_PROJECT_VERSION_TIMESTAMP ?= $(shell TZ=Europe/Paris date -d '@$(MKT_PROJECT_VERSION_COMMIT_TIMESTAMP)' +%-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)