forked from facebook/litho
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle-ci-publish-snapshot.sh
executable file
·28 lines (25 loc) · 1.07 KB
/
circle-ci-publish-snapshot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/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="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")"
if [ "$CIRCLE_PROJECT_USERNAME" != "facebook" ]; then
echo "Skipping repository. Expected project username to be 'facebook', but was '$CIRCLE_PROJECT_USERNAME'."
exit
elif [ "$CIRCLE_PROJECT_REPONAME" != "litho" ]; then
echo "Skipping repository. Expected project name to be 'litho', but was '$CIRCLE_PROJECT_REPONAME'."
exit
elif [ "$CIRCLE_BRANCH" != "master" ]; then
echo "Skipping build. Expected branch name to be 'master', but was '$CIRCLE_BRANCH'."
exit
elif [ "$CI_PULL_REQUEST" != "" ]; then
echo "Skipping build. Only considering non-PR builds, but URL was '$CI_PULL_REQUEST'."
exit
elif [ "$IS_SNAPSHOT" == "" ]; then
echo "Skipping build. Given build doesn't appear to be a SNAPSHOT release."
else
"$BASEDIR/gradlew" uploadArchives -PRELEASE_MODE
fi