From edfbd5a90dfbd1f3efbe30ba463522585a0781be Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Fri, 19 Feb 2021 19:24:42 +0500 Subject: [PATCH] Differentiate git/release data for binary data embedding. Fixes #10. --- VERSION | 1 + scripts/shell_helpers/get_git_data.sh | 3 +-- scripts/shell_helpers/get_release_data.sh | 6 ++++++ scripts/show_git_data.sh | 6 +++++- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 VERSION create mode 100644 scripts/shell_helpers/get_release_data.sh diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..c992723 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.1-dev diff --git a/scripts/shell_helpers/get_git_data.sh b/scripts/shell_helpers/get_git_data.sh index 54920aa..6fd619a 100644 --- a/scripts/shell_helpers/get_git_data.sh +++ b/scripts/shell_helpers/get_git_data.sh @@ -1,7 +1,6 @@ # Gets git data. # Should be sourced where neccessary. - export BRANCHNAME=${BRANCHNAME:=$(git branch --no-color --show-current)} export BUILDID=${BUILDID:=$(git rev-list HEAD --count)} export COMMITHASH=${COMMITHASH:=$(git rev-parse --verify HEAD)} -export VERSION=${VERSION:="0.1.0-dev"} +export VERSION=${VERSION:=$(cat VERSION)} diff --git a/scripts/shell_helpers/get_release_data.sh b/scripts/shell_helpers/get_release_data.sh new file mode 100644 index 0000000..0ba2930 --- /dev/null +++ b/scripts/shell_helpers/get_release_data.sh @@ -0,0 +1,6 @@ +# Overrides some variables for release. + +export VERSION=$(cat VERSION) +export BRANCHNAME="release/${VERSION}" +export COMMITHASH="none" +export BUILDID="0" diff --git a/scripts/show_git_data.sh b/scripts/show_git_data.sh index 6dc2d44..92535cf 100755 --- a/scripts/show_git_data.sh +++ b/scripts/show_git_data.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash # Showing git data in console. -source ./scripts/shell_helpers/get_git_data.sh +if [ -d .git ]; then + source ./scripts/shell_helpers/get_git_data.sh +else + source ./scripts/shell_helpers/get_release_data.sh +fi echo "* Branch: ${BRANCHNAME}" echo "* Build ID: ${BUILDID}"