From 97948a5d8cd070b673521e83238510279a1d2dd6 Mon Sep 17 00:00:00 2001 From: bmamihai Date: Sun, 2 Apr 2023 01:17:18 +0300 Subject: [PATCH] added build commit no --- build.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 21971c9..ad7954b 100755 --- a/build.sh +++ b/build.sh @@ -33,18 +33,24 @@ key=" \"version\": \"" count=$(echo ${version%%-*} | grep -o "\." | wc -l) if (( $count > 1 )); then - version=${version%%-*} + version=${version%%-*} else - version="${version%%-*}.0" + if [[ "$1" == "dev" ]];then + cleanprefix=${version#*-} + cleansuffix=${cleanprefix%-*} + version="${version%%-*}.${cleansuffix}" + else + version="${version%%-*}.0" # one `%` remove everything after last `-`, two `%%` remove everything after all `-` + fi fi if [ -f "$file_pkg" ] && [ ! -z "$version" ]; then version=" \"version\": \"$version\"," sed -i "s|^.*$key.*|${version//\//\\/}|g" $file_pkg text=$(cat $file_pkg | grep -c "$version") if [ $text -eq 0 ]; then - echo "Version couldn't be set" + echo "Version couldn't be set" else - echo "Version $version successfully applied to App" + echo "Version $version successfully applied to App" fi fi