Skip to content

Commit 9df3c8d

Browse files
committed
versioning tags
1 parent 462dea3 commit 9df3c8d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

makeversion

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
#!/usr/bin/env bash
22

3-
# A script that prints a string identifying the current version of the code
4-
# This is used in the build process as a fallback
3+
# Print a string identifying the current version of the code.
4+
# This is used in the build process.
55

66
# projectversion=`git describe --tags --long`
77
# cleanversion=${projectversion%%-*}
88

99
revisioncount=`git log --oneline | wc -l`
1010
ts=`date +%Y%m%d.%H%M%S`
1111
id=`git rev-parse --short HEAD`
12+
tag=`git tag --points-at HEAD`
1213

1314
if git diff --quiet --exit-code HEAD; then
14-
echo $id-$revisioncount-snapshot
15+
if [ -z "$tag" ]; then
16+
# clean working dir but untagged commit
17+
echo snapshot-$id-$revisioncount
18+
else
19+
# clean working dir on tagged commit
20+
echo $tag
21+
fi
1522
else
16-
echo $ts-dev
23+
# dirty working dir
24+
echo dev-$ts
1725
fi

0 commit comments

Comments
 (0)