Skip to content

Commit 6ef0a28

Browse files
authored
Add versioning based on branch and tag or commit. (#1957)
* Update ds_version.sh * Update ds_version.sh
1 parent 52a778e commit 6ef0a28

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

.scripts/ds_version.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ ds_version() {
1010
# Get the branch
1111
Branch="$(git symbolic-ref --short -q HEAD)"
1212
# Get the current tag. If no tag, use the commit instead.
13-
Version="$(git describe --tags --exact-match 2> /dev/null)" || Version="commit $(git rev-parse --short HEAD)"
13+
Version="$(git describe --tags --exact-match 2> /dev/null || true)"
14+
if [[ -z ${Version} ]]; then
15+
Version="commit $(git rev-parse --short HEAD)"
16+
fi
1417

1518
echo "${Branch} ${Version}"
1619
popd &> /dev/null

0 commit comments

Comments
 (0)