From 33b77ef9ece52866b85450af69f36123cd13e47e Mon Sep 17 00:00:00 2001 From: Tom Reznik Date: Tue, 19 May 2015 22:12:22 +0200 Subject: [PATCH] Auto-deploy snapshots to Sonatype --- .buildscript/deploy_snapshot.sh | 26 +++++++++++++ .buildscript/settings.xml | 9 +++++ .gitignore | 1 - .travis.yml | 16 +++++--- README.md | 3 ++ pom.xml | 65 ++++++++++++++++----------------- 6 files changed, 81 insertions(+), 39 deletions(-) create mode 100755 .buildscript/deploy_snapshot.sh create mode 100644 .buildscript/settings.xml diff --git a/.buildscript/deploy_snapshot.sh b/.buildscript/deploy_snapshot.sh new file mode 100755 index 00000000..b0a91c55 --- /dev/null +++ b/.buildscript/deploy_snapshot.sh @@ -0,0 +1,26 @@ +#!/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..." + mvn clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -Dmaven.test.skip=true + echo "Snapshot deployed!" +fi \ No newline at end of file diff --git a/.buildscript/settings.xml b/.buildscript/settings.xml new file mode 100644 index 00000000..4f18cc59 --- /dev/null +++ b/.buildscript/settings.xml @@ -0,0 +1,9 @@ + + + + sonatype-nexus-snapshots + ${env.CI_DEPLOY_USERNAME} + ${env.CI_DEPLOY_PASSWORD} + + + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 93c2951c..acd83f26 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ .idea/ *.iml target/ -settings.xml diff --git a/.travis.yml b/.travis.yml index 331b1bce..fd996e34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,20 @@ language: java -install: mvn install -DskipTests=true -Dgpg.skip=true -sudo: false jdk: - oraclejdk7 - oraclejdk8 +after_success: + - .buildscript/deploy_snapshot.sh + - mvn clean cobertura:cobertura coveralls:report + +env: + global: + - secure: ZkYu76rxDUUgoUSIz12CReNZHd2c5O2LBWCHnuQpqfJfcCXBr1J24F7WftiFXH+9Od43qHdF4hQ9Vy0vWEHSJ1hxZnCIy5yYsvqV4GJ94DIJhvNqmo48QPkA3tFUsqd48rEeBXMUsON30m89KDp1se2+l3UJaX+R27RUi47nraU= + - secure: jKXD1hYVgJypaQHRSm4gshxMhB+T+UibaLDLCSfGWSaGzogDsWnPXf9qqG3jtozKHyH0BkANaaO6rRgNQNfbaklm4jopL1bdRkd47JO/nibNwuVcG07TQyCPQR6jv/WoRAkxXOGdMSwwS2+puM7FJqLarbzY7uBEJtNsZn5JT48= + +sudo: false + branches: except: - gh-pages - -after_success: - - mvn clean cobertura:cobertura coveralls:report diff --git a/README.md b/README.md index 52472ef3..2fa0b67d 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ or Gradle: compile 'com.contentful.java:java-sdk:2.0.2' ``` +Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap]. + The SDK requires at minimum Java 6 or Android 2.3. ### Default Client @@ -212,3 +214,4 @@ Copyright (c) 2015 Contentful GmbH. See [LICENSE.txt][6] for further details. [6]: LICENSE.txt [7]: https://github.com/contentful/contentful.java/wiki/2.0-Migration [8]: pom.xml + [snap]: https://oss.sonatype.org/content/repositories/snapshots/ \ No newline at end of file diff --git a/pom.xml b/pom.xml index 0ea73856..661c1a3a 100644 --- a/pom.xml +++ b/pom.xml @@ -248,40 +248,39 @@ - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - true - - - - - sign-artifacts - verify - - sign - - - - - - - sonatype.oss.snapshots - Sonatype OSS Snapshot Repository - http://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - + + + release + + false + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + true + + + + + sign-artifacts + verify + + sign + + + + + + + +