Set up automatic android snapshot publishing

Summary:
Set up automatic publishing to Maven Snapshots if the current
VERSION_NAME ends in `-SNAPSHOT`.

Reviewed By: danielbuechele

Differential Revision: D9539838

fbshipit-source-id: 6e413fa3b02966946bb867eebe7ba8b863f291b9
This commit is contained in:
Pascal Hartig
2018-08-29 07:02:35 -07:00
committed by Facebook Github Bot
parent 52fe553e21
commit 91b6cf1c6a
3 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#!/usr/bin/bash
set -e
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")"
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."
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
fi