Skip to content

Commit ed8cf08

Browse files
committed
[NRL-793] Use tag for current-info version if branch is HEAD
1 parent 072f141 commit ed8cf08

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/get-current-info.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
set -o errexit -o nounset -o pipefail
44

55
BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)"
6+
TAG_NAME="$(git describe --tags)"
67
SHORT_COMMIT_HASH="$(git rev-parse --short=8 HEAD)"
78

8-
echo "{ \"version\": \"${BRANCH_NAME}@${SHORT_COMMIT_HASH}\" }"
9+
if [ "${BRANCH_NAME}" == "HEAD" ]; then
10+
NRLF_VERSION="${TAG_NAME}@${SHORT_COMMIT_HASH}"
11+
else
12+
NRLF_VERSION="${BRANCH_NAME}@${SHORT_COMMIT_HASH}"
13+
fi
14+
15+
cat << EOF
16+
{
17+
"version": "${NRLF_VERSION}",
18+
"tag": "${TAG_NAME}",
19+
"branch": "${BRANCH_NAME}",
20+
"commit": "${SHORT_COMMIT_HASH}"
21+
}
22+
EOF

0 commit comments

Comments
 (0)