diff --git a/.gitignore b/.gitignore index ead45993..25c6c794 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ build/ gen/ obj/ .gradle/ +syncthing/gobuild +syncthing/pkg # Local configuration file (sdk path, etc) local.properties diff --git a/.travis.yml b/.travis.yml index 87acdde8..4ac7af40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,3 +39,6 @@ cache: script: - ./gradlew lint - ./gradlew buildNative assembleDebug + +notifications: + email: false diff --git a/prepare-release.bash b/prepare-release.bash index 9ac7fa7b..5d44ed61 100755 --- a/prepare-release.bash +++ b/prepare-release.bash @@ -2,99 +2,11 @@ set -e -NEW_VERSION_NAME=$1 -LATEST_TAG=$2 -OLD_VERSION_NAME=$(grep "versionName" "app/build.gradle" | awk '{print $2}') -if [[ -z ${NEW_VERSION_NAME} ]] -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 )" -cd "syncthing/src/github.com/syncthing/syncthing/" -git fetch -CURRENT_TAG=$(git describe) -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 -fi - -if [ ${CURRENT_TAG} != ${LATEST_TAG} ]; then - git checkout -f ${LATEST_TAG} - cd ${PROJECT_DIR} - git add "syncthing/src/github.com/syncthing/syncthing/" - git commit -m "Updated Syncthing to $LATEST_TAG" - ./gradlew cleanNative buildNative -fi -cd ${PROJECT_DIR} - - -echo " - -Updating Translations ------------------------------ -" -tx push -s -# 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. -# 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 -./gradlew deleteUnsupportedPlayTranslations -git add -A "app/src/main/play/" -git add -A "app/src/main/res/values-*/strings.xml" -if ! git diff --cached --exit-code; -then - git commit -m "Imported translations" -fi - - -echo " - -Running Lint ------------------------------ -" -./gradlew clean lintVitalRelease - -echo " - -Enter Changelog for $NEW_VERSION_NAME ------------------------------ -" -changelog_file="build/changelog.tmp" -touch ${changelog_file} -nano ${changelog_file} - -cat ${changelog_file} -mv ${changelog_file} "app/src/main/play/en-GB/whatsnew" - -echo " - -Updating Version ------------------------------ -" -OLD_VERSION_CODE=$(grep "versionCode" "app/build.gradle" -m 1 | awk '{print $2}') -NEW_VERSION_CODE=$(($OLD_VERSION_CODE + 1)) -sed -i "s/versionCode $OLD_VERSION_CODE/versionCode $NEW_VERSION_CODE/" "app/build.gradle" - -OLD_VERSION_NAME=$(grep "versionName" "app/build.gradle" | awk '{print $2}') -sed -i "s/$OLD_VERSION_NAME/\"$1\"/" "app/build.gradle" -git add "app/build.gradle" "app/src/main/play/en-GB/whatsnew" -git commit -m "Bumped version to $NEW_VERSION_NAME" -git tag ${NEW_VERSION_NAME} +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +$SCRIPT_DIR/update-syncthing.bash "$2" +$SCRIPT_DIR/check-version.bash "$1" +$SCRIPT_DIR/pull-translations.bash +$SCRIPT_DIR/bump-version.bash "$1" echo " Update ready. diff --git a/publish-release.sh b/publish-release.sh deleted file mode 100755 index 820c0651..00000000 --- a/publish-release.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -set -e - -version=$(git describe --tags) -regex='^[0-9]+\.[0-9]+\.[0-9]+$' -if [[ ! ${version} =~ $regex ]] -then - echo "Current commit is not a release" - exit; -fi - -echo " - -Pushing to Github ------------------------------ -" -git push -git push --tags - -echo " - -Push to Google Play ------------------------------ -" - -read -s -p "Enter signing password: " password - -SIGNING_PASSWORD=${password} ./gradlew assembleRelease - -# Upload apk and listing to Google Play -SIGNING_PASSWORD=${password} ./gradlew publishRelease - -echo " - -Release published! -" - -#echo " -# -#Create Github Release -#----------------------------- -#" -#ACCESS_TOKEN="" -#api_json=$(printf '{"tag_name": "v%s","target_commitish": "master","name": "v%s","body": "%s","draft": false,"prerelease": false}' $version $version $changelog) -#curl --data "$api_json" https://api.github.com/repos/syncthing/syncthing-android/releases?access_token=$ACCESS_TOKEN diff --git a/scripts/check-version.bash b/scripts/check-version.bash index e1b65f25..4aee1193 100755 --- a/scripts/check-version.bash +++ b/scripts/check-version.bash @@ -17,7 +17,7 @@ fi cd "syncthing/src/github.com/syncthing/syncthing/" CURRENT_TAG=$(git describe) -if [ "v${NEW_VERSION_NAME#$CURRENT_TAG}" = "v${NEW_VERSION_NAME}" ]; then +if [ "${NEW_VERSION_NAME#${CURRENT_TAG#v}}" = "${NEW_VERSION_NAME}" ]; then printf "New version name %s is not compatible with Syncthing version %s\n" \ "$NEW_VERSION_NAME" "$CURRENT_TAG" exit 1