From 0955b57d6646073c7107e776f767cf4312100df8 Mon Sep 17 00:00:00 2001 From: Igor Mandrigin Date: Tue, 29 May 2018 10:43:18 +0200 Subject: [PATCH] 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 --- scripts/build_no.sh | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/scripts/build_no.sh b/scripts/build_no.sh index c81df4c685..03d392fa73 100755 --- a/scripts/build_no.sh +++ b/scripts/build_no.sh @@ -27,24 +27,12 @@ REGEX='^build-[0-9]\+$' # make sure we have all the tags 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 -if [ 1 -lt $(echo "$BUILD" | grep -c -) ]; then - echo "Commit marked with one than one build tag!" >&2 - echo "$BUILD" >&2 - exit 1 -fi +# even if the current commit has a tag already, it is normal that the same commit +# is built multiple times (with different build configurations, for instance), +# so we increment the build number every time. -# use already existing build number if applicable -if [ -n "$BUILD" ]; then - echo "Current commit already tagged: $BUILD" >&2 - getNumber $BUILD - exit 0 -fi - -# otherwise find the last used build number +# find the last used build number BUILD=$(git tag -l --sort=-v:refname | grep -e "$REGEX" | head -n 1) # extract the number BUILD_NO=$(getNumber "$BUILD")