Allow multiple build tags for a single commit.
Any commit can be built multiple times with different configurations. We want the build number to be different for each of them to be able to simultaneously upload them to GP or iTC. Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
parent
14a3134edd
commit
0955b57d66
|
@ -27,24 +27,12 @@ REGEX='^build-[0-9]\+$'
|
||||||
# make sure we have all the tags
|
# make sure we have all the tags
|
||||||
git fetch --tags --quiet
|
git fetch --tags --quiet
|
||||||
|
|
||||||
# check if current commit has a build tag
|
|
||||||
BUILD=$(git tag --points-at HEAD | grep -e "$REGEX")
|
|
||||||
|
|
||||||
# chech for multiple lines
|
# even if the current commit has a tag already, it is normal that the same commit
|
||||||
if [ 1 -lt $(echo "$BUILD" | grep -c -) ]; then
|
# is built multiple times (with different build configurations, for instance),
|
||||||
echo "Commit marked with one than one build tag!" >&2
|
# so we increment the build number every time.
|
||||||
echo "$BUILD" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# use already existing build number if applicable
|
# find the last used build number
|
||||||
if [ -n "$BUILD" ]; then
|
|
||||||
echo "Current commit already tagged: $BUILD" >&2
|
|
||||||
getNumber $BUILD
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# otherwise find the last used build number
|
|
||||||
BUILD=$(git tag -l --sort=-v:refname | grep -e "$REGEX" | head -n 1)
|
BUILD=$(git tag -l --sort=-v:refname | grep -e "$REGEX" | head -n 1)
|
||||||
# extract the number
|
# extract the number
|
||||||
BUILD_NO=$(getNumber "$BUILD")
|
BUILD_NO=$(getNumber "$BUILD")
|
||||||
|
|
Loading…
Reference in New Issue