yogastic/environment/dev/docker/cms/scripts/build.docker.build.step.inc.version.sh
2025-01-08 17:12:09 +01:00

18 lines
521 B
Bash
Executable File

#!/usr/bin/env bash
# set the actual commit date and commit hash in version.txt
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
GIT_BRANCH_SHORT=$(echo $GIT_BRANCH | cut -d "/" -f 1)
GIT_COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y%m%d%H%M)
GIT_COMMIT_ID_SHORT=$(git rev-parse --short HEAD)
VERSION=$GIT_COMMIT_DATE.$GIT_COMMIT_ID_SHORT
CURRENT_DIR=$(dirname "$0")
VERSION_FILE="${CURRENT_DIR}/version.txt"
echo "Saving version ${VERSION} to file ${VERSION_FILE}"
echo $VERSION
echo $VERSION > $VERSION_FILE