From d74aba261d5c8e5eacae9ae3ce41e26b292526f5 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Sat, 30 Sep 2017 23:52:00 +0900 Subject: [PATCH] Add publish release script --- build.gradle | 21 ++++++++++++++++ gradle.properties | 4 ++- publish-release.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++ release.bash | 9 ------- 4 files changed, 85 insertions(+), 10 deletions(-) create mode 100755 publish-release.sh delete mode 100755 release.bash diff --git a/build.gradle b/build.gradle index de6d76cd..f0a5a022 100644 --- a/build.gradle +++ b/build.gradle @@ -45,6 +45,11 @@ android { buildTypes.debug.applicationIdSuffix ".debug" dataBinding.enabled = true + playAccountConfigs { + defaultAccountConfig { + jsonFile = file('keys.json') + } + } defaultConfig { applicationId "com.nutomic.syncthingandroid" minSdkVersion 14 @@ -53,6 +58,21 @@ android { versionName "0.9.15" testApplicationId 'com.nutomic.syncthingandroid.test' testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' + playAccountConfig = playAccountConfigs.defaultAccountConfig + } + + signingConfigs { + release { + storeFile file(RELEASE_STORE_FILE) + storePassword System.getenv("SIGNING_PASSWORD") ?: "" + keyAlias RELEASE_KEY_ALIAS + keyPassword System.getenv("SIGNING_PASSWORD") ?: "" + } + } + buildTypes { + release { + signingConfig signingConfigs.release + } } compileOptions { @@ -75,6 +95,7 @@ task cleanNative(type: Delete) { play { jsonFile = file('keys.json') uploadImages = false + track = 'beta' } /** diff --git a/gradle.properties b/gradle.properties index fa751017..397f0a0d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,4 @@ android.useDeprecatedNdk=true -org.gradle.jvmargs=-Xmx2048M \ No newline at end of file +org.gradle.jvmargs=-Xmx2048M +RELEASE_STORE_FILE=/home/felix/workspace/android.keystore +RELEASE_KEY_ALIAS=android \ No newline at end of file diff --git a/publish-release.sh b/publish-release.sh new file mode 100755 index 00000000..50e960a2 --- /dev/null +++ b/publish-release.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +set -e + +version=$(git describe --always) +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 + +version=`git describe --tags --abbrev=0` + +echo " + +Enter Changelog for $version +----------------------------- +" +changelog_file="/tmp/changelog.tmp" +touch +${DEFAULT_EDITOR} $changelog_file + +changelog=`cat $changelog_file` +rm $changelog_file +echo $changelog > "src/main/play/en-GB/whatsnew" + +echo " + +Push to Google Play +----------------------------- +" + +read -p "Enter signing password: " password + +SIGNING_PASSWORD=$password ./gradlew assembleRelease + +# Upload apk and listing to Google Play +./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/release.bash b/release.bash deleted file mode 100755 index 4fb33fb3..00000000 --- a/release.bash +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -CHANGELOG_FILE="src/main/play/en-GB/whatsnew" -rm $CHANGELOG_FILE -nano $CHANGELOG_FILE -cat $CHANGELOG_FILE -git push -git push --tags -./gradlew publishRelease