diff --git a/.circleci/config.yml b/.circleci/config.yml index 69d972217..66d6ad86f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,8 +11,22 @@ jobs: ./gradlew :sample:assembleDebug scripts/publish-android-snapshot.sh + release: + docker: + - image: circleci/android:api-28-ndk-r17b + steps: + - checkout + - run: + name: build and deploy + command: scripts/publish-android-release.sh + workflows: version: 2 build: jobs: - build + - release: + filters: + tags: + - only: /^v.*/ + diff --git a/scripts/bintray-publish-keys.enc b/scripts/bintray-publish-keys.enc new file mode 100644 index 000000000..35f1f110e --- /dev/null +++ b/scripts/bintray-publish-keys.enc @@ -0,0 +1 @@ +Salted__{a]XH%Yhuѹy[=Ǔ:OQ4OZqX6¸COaS*NXT(Ǜ>*!,Fw.T\ dg \ No newline at end of file diff --git a/scripts/publish-android-release.sh b/scripts/publish-android-release.sh new file mode 100755 index 000000000..179ad6964 --- /dev/null +++ b/scripts/publish-android-release.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e + +BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" +IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties" || echo "")" + +if [ "$ANDROID_PUBLISH_KEY" == "" ]; then + echo "No encryption key. Skipping snapshot deployment." + exit +elif [ "$IS_SNAPSHOT" != "" ]; then + echo "Build appears to be a SNAPSHOT release, but this is a script for building stable releases. Skipping ..." + exit 1 +else + openssl aes-256-cbc -d -in scripts/bintray-publish-keys.enc -k "$ANDROID_PUBLISH_KEY" >> "$BASEDIR/gradle.properties" + "$BASEDIR"/gradlew bintrayUpload --info -PdryRun=false +fi diff --git a/scripts/publish-android-snapshot.sh b/scripts/publish-android-snapshot.sh index 266dcec90..179ad6964 100755 --- a/scripts/publish-android-snapshot.sh +++ b/scripts/publish-android-snapshot.sh @@ -7,10 +7,10 @@ IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.propertie if [ "$ANDROID_PUBLISH_KEY" == "" ]; then echo "No encryption key. Skipping snapshot deployment." exit -elif [ "$IS_SNAPSHOT" == "" ]; then - echo "Skipping build. Given build doesn't appear to be a SNAPSHOT release." +elif [ "$IS_SNAPSHOT" != "" ]; then + echo "Build appears to be a SNAPSHOT release, but this is a script for building stable releases. Skipping ..." exit 1 else - openssl aes-256-cbc -d -in scripts/gradle-publish-keys.enc -k "$ANDROID_PUBLISH_KEY" >> "$BASEDIR/gradle.properties" - "$BASEDIR"/gradlew uploadArchives --info + openssl aes-256-cbc -d -in scripts/bintray-publish-keys.enc -k "$ANDROID_PUBLISH_KEY" >> "$BASEDIR/gradle.properties" + "$BASEDIR"/gradlew bintrayUpload --info -PdryRun=false fi