2019-06-20 07:17:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-12-26 10:44:54 +00:00
|
|
|
if ! git diff-index --exit-code --quiet HEAD; then
|
|
|
|
echo "Bumping version aka cutting a release must happen on a clean git workspace"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-06-20 07:17:34 +00:00
|
|
|
NEW_VERSION_NAME=$1
|
2023-12-28 21:37:27 +00:00
|
|
|
OLD_VERSION_NAME=$(grep "versionName" "app/build.gradle.kts" | awk '{print $3}')
|
2019-06-20 07:17:34 +00:00
|
|
|
if [[ -z ${NEW_VERSION_NAME} ]]
|
|
|
|
then
|
|
|
|
echo "New version name is empty. Please set a new version. Current version: $OLD_VERSION_NAME"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
./scripts/check-version.bash "$NEW_VERSION_NAME"
|
|
|
|
|
|
|
|
echo "
|
|
|
|
|
|
|
|
Running Lint
|
|
|
|
-----------------------------
|
|
|
|
"
|
|
|
|
./gradlew clean lintVitalRelease
|
|
|
|
|
|
|
|
echo "
|
|
|
|
|
|
|
|
Enter Changelog for $NEW_VERSION_NAME
|
|
|
|
-----------------------------
|
|
|
|
"
|
|
|
|
CHANGELOG=app/src/main/play/release-notes/en-GB/default.txt
|
2022-10-29 11:27:56 +00:00
|
|
|
if command -v edit >/dev/null; then
|
|
|
|
editor=edit
|
|
|
|
elif [ -n "$EDITOR" ]; then
|
|
|
|
editor="$EDITOR"
|
2023-01-01 20:50:38 +00:00
|
|
|
else
|
2023-01-01 20:56:21 +00:00
|
|
|
echo "No editor found - need either 'edit' binary or EDITOR env var set"
|
|
|
|
exit 1
|
2022-10-29 11:27:56 +00:00
|
|
|
fi
|
|
|
|
$editor $CHANGELOG
|
2019-06-20 07:17:34 +00:00
|
|
|
|
|
|
|
echo "
|
|
|
|
|
|
|
|
Updating Version
|
|
|
|
-----------------------------
|
|
|
|
"
|
2023-12-28 21:37:27 +00:00
|
|
|
OLD_VERSION_CODE=$(grep "versionCode" "app/build.gradle.kts" -m 1 | awk '{print $3}')
|
2019-06-20 07:17:34 +00:00
|
|
|
NEW_VERSION_CODE=$(($OLD_VERSION_CODE + 1))
|
2023-12-28 21:37:27 +00:00
|
|
|
sed -i -e "s/versionCode = $OLD_VERSION_CODE/versionCode = $NEW_VERSION_CODE/" "app/build.gradle.kts"
|
2019-06-20 07:17:34 +00:00
|
|
|
|
2023-12-28 21:37:27 +00:00
|
|
|
OLD_VERSION_NAME=$(grep "versionName" "app/build.gradle.kts" | awk '{print $3}')
|
|
|
|
sed -i -e "s/$OLD_VERSION_NAME/\"$1\"/" "app/build.gradle.kts"
|
|
|
|
git add "app/build.gradle.kts" $CHANGELOG
|
2019-06-20 07:17:34 +00:00
|
|
|
git commit -m "Bumped version to $NEW_VERSION_NAME"
|
2021-02-02 17:57:27 +00:00
|
|
|
git tag -a ${NEW_VERSION_NAME} -m "
|
|
|
|
$NEW_VERSION_NAME
|
|
|
|
|
|
|
|
$(cat $CHANGELOG)
|
|
|
|
"
|