Skip to content

Commit

Permalink
Update .travis.yml (#542)
Browse files Browse the repository at this point in the history
Summary:
deploy to maven

Thanks for proposing a pull request.

To help us review the request, please complete the following:
- [x] sign contributor license agreement: https://developers.facebook.com/opensource/cla
- [x] submit against our `:dev` branch, not `master`.
- [x] describe the change (for example, what happens before the change, and after the change)
Pull Request resolved: #542

Reviewed By: codytwinton

Differential Revision: D13571878

Pulled By: jingping2015

fbshipit-source-id: aff6907bedcdc13db4b8fa9535115729d0611c92
  • Loading branch information
jingping2015 authored and facebook-github-bot committed Jan 11, 2019
1 parent f3e6bf7 commit cdd808d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 22 deletions.
47 changes: 27 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
language: android

android:
components:
- build-tools-26
- build-tools-27.0.3
- android-26
- android-27
- extra

- build-tools-26
- build-tools-27.0.3
- android-26
- android-27
- extra
licenses:
- android-sdk-preview-license-.+
- android-sdk-license-.+
- google-gdk-license-.+

before_install:
- yes | sdkmanager "platforms;android-27"
- chmod +x gradlew

- android-sdk-preview-license-.+
- android-sdk-license-.+
- google-gdk-license-.+
before_install:
- openssl aes-256-cbc -K $encrypted_e83d0815cd6c_key -iv $encrypted_e83d0815cd6c_iv
-in secring.gpg.enc -out secring.gpg -d
- yes | sdkmanager "platforms;android-27"
- chmod +x gradlew
branches:
only:
- master

# Override the install and test so that we don't run integration tests
install:
- ./gradlew assemble

- "./gradlew assemble"
script:
- ./gradlew :facebook:test -i
- "./gradlew :facebook:test -i"
- .travis/deploy.sh

env:
global:
- # GPG_KEY_ID
- secure: b54RmQZS4+RqvJGLM5tlosWshEQmygOpcpcVE2UXKdDuk0OHPwk+67dn20mbCOhdZJc0MQ51ot6jAPTnFzKqgnwb37KIgxWOTzVzv0uxWJ7SWI/5AU4CdU3G1s24PGZcDOJ0sfWCyH8xArnJToH0pBIo4PHeB6csGtKsgKp7aVM=
- # GPG_KEY_PASSPHRASE
- secure: CqDRGAfI/gwsUzgLTbrqfX+VMsLnOuk/aoH6fXMW8lqE55/aJzHqdhuOuiVvJsBa+tVuxV06FI/3AZKYxzYgNt55lNU6JurOSeawE5WN8zhKdSNxtKlFypRQqAV0Od5MXrTY6pKgc3JSoM2WOx8+8AUaYMfycv4qNyu14E47n90=
- # NEXUS_USERNAME
- secure: B7LncUtbP4gpLDa2aMFLnVKcAWzp76ZRAH5EHPFVP70UCEMJjPnTxP/OPV8QOFdNW98duuro8XQrr7CEjVaYWcLddyp8WZpulnj8OtqzlaQ2HSWQYdZPPBdWeTj20B994nPGaqg1N0t0ojdH6zj7cOIE2kqro7RrRYovpYq6bVk=
- # NEXUS_PASSWORD
- secure: OhGzIa1cnT7n6f8MatrhyeJ0KldqB+KsrE47L35+yq9KiuVCZ/4CEawwrtxNVJn02lrue/0ZM9Ya9UwfMy6kCv3rx7rkNyj6ySylUqRjkfOZheN8QkS4ujsDZTYZyROxtc3ISO1hunIzxXsOeGCopPC3FaVbLQeupa3v/5HJrQ0=
33 changes: 33 additions & 0 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2015-present Facebook. All Rights Reserved.

# shellcheck disable=SC2086
# shellcheck disable=SC2006

VERSION_CLASS=facebook-core/src/main/java/com/facebook/FacebookSdkVersion.java
id1=`git log -n 1 --pretty=format:%H -- $VERSION_CLASS`
id2=`git show -n 1 --pretty=format:%H`
if [ "$id1" == "$id2" ]; then
FB_SRC_FOLDERS=(
'facebook-core'
'facebook-common'
'facebook-login'
'facebook-share'
'facebook-places'
'facebook-messenger'
'facebook-applinks'
'facebook-marketing'
'facebook'
)

for (( i = 0; i < ${#FB_SRC_FOLDERS[@]}; i++ ))
do
FOLDER=${FB_SRC_FOLDERS[$i]}
echo "Publishing $FOLDER SDK to maven central";
cp secring.gpg $FOLDER/
./gradlew uploadArchives -p $FOLDER -PossrhUsername=${NEXUS_USERNAME} -PossrhPassword=${NEXUS_PASSWORD} -Psigning.keyId=${GPG_KEY_ID} -Psigning.password=${GPG_KEY_PASSPHRASE} -Psigning.secretKeyRingFile=secring.gpg || die "Failed to publish $FOLDER SDK to maven central"
rm $FOLDER/secring.gpg
done

else
echo 'No version update for this commit.';
fi
4 changes: 2 additions & 2 deletions maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ apply plugin: 'maven'
apply plugin: 'signing'

def isSnapshot = version.endsWith('-SNAPSHOT')
def ossrhUsername = hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
def ossrhPassword = hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
def ossrhUsername = hasProperty('ossrhUsername') ? ossrhUsername : ""
def ossrhPassword = hasProperty('ossrhPassword') ? ossrhPassword : ""

task setVersion {
// The version will be derived from source
Expand Down
Binary file added secring.gpg.enc
Binary file not shown.

0 comments on commit cdd808d

Please sign in to comment.