From d245af4d9cbccda260d057a7bde62d0afa6f4725 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Thu, 5 Nov 2020 15:06:00 +0100 Subject: [PATCH] increment_version.sh: Add possibility for test releases Change-Id: I1ae628b56d0d2f49373cf507815f5efa3a881208 --- increment_version.sh | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/increment_version.sh b/increment_version.sh index ee9dce96d9..563fb19886 100755 --- a/increment_version.sh +++ b/increment_version.sh @@ -8,6 +8,13 @@ source "$mydir/merge_helpers.sh" require_clean_git +if [ "$1" = "test" ]; then + release_type="test" + previousTestVersionCode="$2" +else + release_type="normal" +fi + pushd "$mydir" > /dev/null @@ -49,7 +56,12 @@ scVersion=`get_prop ext.scVersion` previousVersionCode=`grep '^ versionCode ' "$build_gradle" | sed 's|^ versionCode ||'` versionCode=`calculate_version_code` -if [ "$versionCode" = "$previousVersionCode" ]; then +if [ "$release_type" = "test" ]; then + if [ ! -z "$previousTestVersionCode" ]; then + previousVersionCode=$((previousVersionCode > previousTestVersionCode ? previousVersionCode : previousTestVersionCode)) + fi + versionCode=$((previousVersionCode + 1)) +elif [ "$versionCode" = "$previousVersionCode" ]; then ((scVersion++)) echo "Increase downstream version to $scVersion" versionCode=`calculate_version_code` @@ -74,11 +86,17 @@ changelog_dir=fastlane/metadata/android/en-US/changelogs changelog_file="$changelog_dir/$versionCode.txt" mkdir -p "$changelog_dir" git log --reverse --pretty=format:"- %s" "$last_tag".. --committer="$(git config user.name)" > "$changelog_file" -$EDITOR "$changelog_file" || true -read -p "Press enter when changelog is done" +if [ "$release_type" != "test" ]; then + $EDITOR "$changelog_file" || true + read -p "Press enter when changelog is done" +fi git add -A -git commit -m "Increment version" -git tag "$new_tag" +if [ "$release_type" = "test" ]; then + git commit -m "Test version $versionCode" +else + git commit -m "Increment version" + git tag "$new_tag" +fi popd > /dev/null