increment_version.sh: Add possibility for test releases
Change-Id: I1ae628b56d0d2f49373cf507815f5efa3a881208
This commit is contained in:
parent
6844c71987
commit
d245af4d9c
|
@ -8,6 +8,13 @@ source "$mydir/merge_helpers.sh"
|
||||||
|
|
||||||
require_clean_git
|
require_clean_git
|
||||||
|
|
||||||
|
if [ "$1" = "test" ]; then
|
||||||
|
release_type="test"
|
||||||
|
previousTestVersionCode="$2"
|
||||||
|
else
|
||||||
|
release_type="normal"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
pushd "$mydir" > /dev/null
|
pushd "$mydir" > /dev/null
|
||||||
|
|
||||||
|
@ -49,7 +56,12 @@ scVersion=`get_prop ext.scVersion`
|
||||||
|
|
||||||
previousVersionCode=`grep '^ versionCode ' "$build_gradle" | sed 's|^ versionCode ||'`
|
previousVersionCode=`grep '^ versionCode ' "$build_gradle" | sed 's|^ versionCode ||'`
|
||||||
versionCode=`calculate_version_code`
|
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++))
|
((scVersion++))
|
||||||
echo "Increase downstream version to $scVersion"
|
echo "Increase downstream version to $scVersion"
|
||||||
versionCode=`calculate_version_code`
|
versionCode=`calculate_version_code`
|
||||||
|
@ -74,11 +86,17 @@ changelog_dir=fastlane/metadata/android/en-US/changelogs
|
||||||
changelog_file="$changelog_dir/$versionCode.txt"
|
changelog_file="$changelog_dir/$versionCode.txt"
|
||||||
mkdir -p "$changelog_dir"
|
mkdir -p "$changelog_dir"
|
||||||
git log --reverse --pretty=format:"- %s" "$last_tag".. --committer="$(git config user.name)" > "$changelog_file"
|
git log --reverse --pretty=format:"- %s" "$last_tag".. --committer="$(git config user.name)" > "$changelog_file"
|
||||||
$EDITOR "$changelog_file" || true
|
if [ "$release_type" != "test" ]; then
|
||||||
read -p "Press enter when changelog is done"
|
$EDITOR "$changelog_file" || true
|
||||||
|
read -p "Press enter when changelog is done"
|
||||||
|
fi
|
||||||
|
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "Increment version"
|
if [ "$release_type" = "test" ]; then
|
||||||
git tag "$new_tag"
|
git commit -m "Test version $versionCode"
|
||||||
|
else
|
||||||
|
git commit -m "Increment version"
|
||||||
|
git tag "$new_tag"
|
||||||
|
fi
|
||||||
|
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
Loading…
Reference in New Issue