#!/bin/bash
#
# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo.
#
# Adapted from https://coderwall.com/p/9b_lfq and
# http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/

SLUG="contentful/contentful.java"
JDK="oraclejdk8"
BRANCH="master"

set -e

if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then
  echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'."
elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then
  echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'."
elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
  echo "Skipping snapshot deployment: was pull request."
elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
  echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
else
  echo "Deploying snapshot to maven ..."
  mvn clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -Dmaven.test.skip=true
  echo "Snapshot deployed to maven!"
fi

echo "Deploying snapshot to jitpack ..."
curl https://jitpack.io/com/github/contentful/contentful.java/${TRAVIS_BRANCH}-SNAPSHOT
echo "Snapshot deployed to jitpack!"


#!/bin/bash
#
# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo.
#
# Adapted from https://coderwall.com/p/9b_lfq and
# http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/

SLUG="contentful/contentful.java"
JDK="oraclejdk8"
BRANCH="master"

set -e

if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then
  echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'."
elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then
  echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'."
elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
  echo "Skipping snapshot deployment: was pull request."
elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
  echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
else
  echo "Deploying snapshot to maven ..."
  mvn clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -Dmaven.test.skip=true
  echo "Snapshot deployed to maven!"

  echo "Deploying snapshot to jitpack ..."
  curl https://jitpack.io/com/github/contentful/contentful.java/master-SNAPSHOT/build.log
  echo "Snapshot deployed to jitpack!"
fi

--- 
+++ 
@@ -23,8 +23,9 @@
   echo "Deploying snapshot to maven ..."
   mvn clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -Dmaven.test.skip=true
   echo "Snapshot deployed to maven!"
+fi
 
-  echo "Deploying snapshot to jitpack ..."
-  curl https://jitpack.io/com/github/contentful/contentful.java/master-SNAPSHOT/build.log
-  echo "Snapshot deployed to jitpack!"
-fi
+echo "Deploying snapshot to jitpack ..."
+curl https://jitpack.io/com/github/contentful/contentful.java/${TRAVIS_BRANCH}-SNAPSHOT
+echo "Snapshot deployed to jitpack!"
+
Make travis deploy to jitpack on every branch
