From c3982b6c1e46624248674311ded115ecadaec1f5 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Tue, 9 May 2017 08:48:47 -0700 Subject: [PATCH] Set up for automatic snapshot publishing Summary: Gets all the pieces in place to automatically publish snapshot artifacts after successful travis build. I'll test the actual publishing in a separate branch and then flip the switch in a separate diff when it's ready. Reviewed By: emilsjolander Differential Revision: D5028239 fbshipit-source-id: c57d02a1dee41c84001bd17821b050c8c9aa4134 --- .travis.yml | 1 + scripts/circle-ci-publish-snapshot.sh | 25 +++++++++++++++++++++++++ scripts/setup-keys.enc | 1 + 3 files changed, 27 insertions(+) create mode 100755 scripts/circle-ci-publish-snapshot.sh create mode 100644 scripts/setup-keys.enc diff --git a/.travis.yml b/.travis.yml index cd3c87f0..c33bdd0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ env: - TARGET=android before_install: + - openssl aes-256-cbc -K $encrypted_d27e803291ff_key -iv $encrypted_d27e803291ff_iv -in scripts/setup-keys.enc -d >> gradle.properties - brew update > /dev/null - brew install --HEAD facebook/fb/buck diff --git a/scripts/circle-ci-publish-snapshot.sh b/scripts/circle-ci-publish-snapshot.sh new file mode 100755 index 00000000..847832cd --- /dev/null +++ b/scripts/circle-ci-publish-snapshot.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# +# Deploy a SNAPSHOT JAR after every successful Circle CI To Sonatype. +# See https://circleci.com/docs/1.0/environment-variables/ +# + +set -e + +BASEDIR="$(readlink -m "$(dirname "$0")/..")" +IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")" + +if [ "$TRAVIS_REPO_SLUG" != "facebook/yoga" ]; then + echo "Skipping repository. Expected project to be 'facebook/yoga', but was '$TRAVIS_REPO_SLUG'." + exit +elif [ "$TRAVIS_BRANCH" != "master" ]; then + echo "Skipping build. Expected branch name to be 'master', but was '$TRAVIS_BRANCH'." + exit +elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + echo "Skipping build. Only considering non-PR builds, but URL was '$TRAVIS_PULL_REQUEST'." + exit +elif [ "$IS_SNAPSHOT" == "" ]; then + echo "Skipping build. Given build doesn't appear to be a SNAPSHOT release." +else + "$BASEDIR/gradlew" uploadArchives +fi diff --git a/scripts/setup-keys.enc b/scripts/setup-keys.enc new file mode 100644 index 00000000..89144cbf --- /dev/null +++ b/scripts/setup-keys.enc @@ -0,0 +1 @@ +kþèçßÞ=+\Mòènýmq6©Pƒáq³Z<¦c%§Þãjô¾d«–îŠÐ(¿Š»ê9C7P`]×ùæ®#ûZŸ+¼™‡ê¹^ 7¾¹‹ôÙ*–³¬rç`LàA™1m°’0h¥n% vâù \ No newline at end of file