• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo.
4#
5# Adapted from https://coderwall.com/p/9b_lfq and
6# https://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/
7
8SLUG="square/javapoet"
9JDK="openjdk8"
10BRANCH="master"
11
12set -e
13
14if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then
15  echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'."
16elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then
17  echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'."
18elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
19  echo "Skipping snapshot deployment: was pull request."
20elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
21  echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
22else
23  echo "Deploying snapshot..."
24  mvn clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -Dmaven.test.skip=true
25  echo "Snapshot deployed!"
26fi
27