2016-09-13 20:43:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
NEW_VERSION_NAME=$1
|
2018-10-03 18:40:22 +00:00
|
|
|
LATEST_TAG=$2
|
2017-10-24 05:55:28 +00:00
|
|
|
OLD_VERSION_NAME=$(grep "versionName" "app/build.gradle" | awk '{print $2}')
|
2017-10-11 03:55:12 +00:00
|
|
|
if [[ -z ${NEW_VERSION_NAME} ]]
|
2016-09-13 20:43:25 +00:00
|
|
|
then
|
|
|
|
echo "New version name is empty. Please set a new version. Current version: $OLD_VERSION_NAME"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "
|
|
|
|
|
|
|
|
Checking for Syncthing Update
|
|
|
|
-----------------------------
|
|
|
|
"
|
|
|
|
PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2017-10-24 05:55:28 +00:00
|
|
|
cd "syncthing/src/github.com/syncthing/syncthing/"
|
2016-09-13 20:43:25 +00:00
|
|
|
git fetch
|
|
|
|
CURRENT_TAG=$(git describe)
|
2018-10-03 18:40:22 +00:00
|
|
|
if [ -z "$LATEST_TAG" ]; then
|
|
|
|
# Also consider Syncthing rc releases if we are building beta or rc.
|
|
|
|
if [[ "$NEW_VERSION_NAME" == *beta* ]] || [[ "$NEW_VERSION_NAME" == *rc* ]]; then
|
|
|
|
LATEST_TAG=$(git tag --sort=taggerdate | tail -1)
|
|
|
|
else
|
|
|
|
LATEST_TAG=$(git tag --sort=taggerdate | awk '!/rc/' | tail -1)
|
|
|
|
fi
|
2017-10-24 15:37:36 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${CURRENT_TAG} != ${LATEST_TAG} ]; then
|
2017-10-11 03:55:12 +00:00
|
|
|
git checkout -f ${LATEST_TAG}
|
|
|
|
cd ${PROJECT_DIR}
|
2017-10-24 05:55:28 +00:00
|
|
|
git add "syncthing/src/github.com/syncthing/syncthing/"
|
2016-09-13 20:43:25 +00:00
|
|
|
git commit -m "Updated Syncthing to $LATEST_TAG"
|
|
|
|
./gradlew cleanNative buildNative
|
|
|
|
fi
|
2017-10-11 03:55:12 +00:00
|
|
|
cd ${PROJECT_DIR}
|
2016-09-13 20:43:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
echo "
|
|
|
|
|
|
|
|
Updating Translations
|
|
|
|
-----------------------------
|
|
|
|
"
|
|
|
|
tx push -s
|
2017-09-19 16:33:16 +00:00
|
|
|
# Force push/pull to make sure this is executed. Apparently tx only compares timestamps, not file
|
|
|
|
# contents. So if a file was `touch`ed, it won't be updated by default.
|
2017-10-26 04:07:14 +00:00
|
|
|
# Use multiple transifex instances for pulling to speed things up.
|
|
|
|
tx pull -a -f -r "syncthing-android.stringsxml" &
|
|
|
|
tx pull -a -f -r "syncthing-android.description_fulltxt" &
|
|
|
|
tx pull -a -f -r "syncthing-android.description_shorttxt" &
|
|
|
|
tx pull -a -f -r "syncthing-android.titletxt" &
|
|
|
|
wait
|
2016-12-16 09:46:34 +00:00
|
|
|
./gradlew deleteUnsupportedPlayTranslations
|
2017-10-24 05:55:28 +00:00
|
|
|
git add -A "app/src/main/play/"
|
|
|
|
git add -A "app/src/main/res/values-*/strings.xml"
|
2016-09-13 20:43:25 +00:00
|
|
|
if ! git diff --cached --exit-code;
|
|
|
|
then
|
|
|
|
git commit -m "Imported translations"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "
|
|
|
|
|
2017-10-11 03:55:12 +00:00
|
|
|
Running Lint
|
2016-09-13 20:43:25 +00:00
|
|
|
-----------------------------
|
|
|
|
"
|
2017-10-11 03:55:12 +00:00
|
|
|
./gradlew clean lintVitalRelease
|
|
|
|
|
|
|
|
echo "
|
|
|
|
|
|
|
|
Enter Changelog for $NEW_VERSION_NAME
|
|
|
|
-----------------------------
|
|
|
|
"
|
|
|
|
changelog_file="build/changelog.tmp"
|
|
|
|
touch ${changelog_file}
|
|
|
|
nano ${changelog_file}
|
|
|
|
|
|
|
|
cat ${changelog_file}
|
2017-10-24 05:55:28 +00:00
|
|
|
mv ${changelog_file} "app/src/main/play/en-GB/whatsnew"
|
2016-09-13 20:43:25 +00:00
|
|
|
|
|
|
|
echo "
|
|
|
|
|
|
|
|
Updating Version
|
|
|
|
-----------------------------
|
|
|
|
"
|
2017-10-24 05:55:28 +00:00
|
|
|
OLD_VERSION_CODE=$(grep "versionCode" "app/build.gradle" -m 1 | awk '{print $2}')
|
2016-09-13 20:43:25 +00:00
|
|
|
NEW_VERSION_CODE=$(($OLD_VERSION_CODE + 1))
|
2017-10-24 05:55:28 +00:00
|
|
|
sed -i "s/versionCode $OLD_VERSION_CODE/versionCode $NEW_VERSION_CODE/" "app/build.gradle"
|
2016-09-13 20:43:25 +00:00
|
|
|
|
2017-10-24 05:55:28 +00:00
|
|
|
OLD_VERSION_NAME=$(grep "versionName" "app/build.gradle" | awk '{print $2}')
|
2017-10-24 12:43:18 +00:00
|
|
|
sed -i "s/$OLD_VERSION_NAME/\"$1\"/" "app/build.gradle"
|
2017-10-24 05:55:28 +00:00
|
|
|
git add "app/build.gradle" "app/src/main/play/en-GB/whatsnew"
|
2016-09-13 20:43:25 +00:00
|
|
|
git commit -m "Bumped version to $NEW_VERSION_NAME"
|
2017-10-11 03:55:12 +00:00
|
|
|
git tag ${NEW_VERSION_NAME}
|
2016-09-13 20:43:25 +00:00
|
|
|
|
|
|
|
echo "
|
2016-12-23 09:03:14 +00:00
|
|
|
Update ready.
|
2016-09-13 20:43:25 +00:00
|
|
|
"
|