Skip to content

Commit

Permalink
Auto-deploy snapshots from Travis CI to Sonatype.
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWharton committed Dec 20, 2014
1 parent 2c1c6ec commit a38b6be
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .buildscript/deploy_snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/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="square/retrofit"
JDK="oraclejdk8"
BRANCH="master"

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
9 changes: 9 additions & 0 deletions .buildscript/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<settings>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.CI_DEPLOY_USERNAME}</username>
<password>${env.CI_DEPLOY_PASSWORD}</password>
</server>
</servers>
</settings>
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
language: java

jdk:
- oraclejdk7
- oraclejdk8

after_success:
- .buildscript/deploy_snapshot.sh

env:
global:
- secure: "M0bjPTMwinz0uXN6qjXcpyfvhz/YX9W7ty4RdV90jMU8ZJxSdGdKXRy1N0TsMO8ciOQ2fryE/FpiX+arrphnVvqUmGBh386lGvj1rhgrVqXNqlGE23cQpzHsQ0nNqTGIxnoE4dmJF3PjWoYG+B4WbFsSb3PB7sEjpLq7klqGeHk="
- secure: "iL5BdYAmMaEDRKxNx1d9Zxn0tfJhCzXBGUvn+p7QGeQDUSVCdCc8cXS4ePbRj0401pK20nK1OouIi0lLP+z0QpZY6RrKIEncGOZeSFPQbS/vnZ7niCYJQdXCZ/GOlYUkAW2AsQl5bzzHYbHKX/TVgTuO3iFlbyeoZZuIjD3VaiM="

branches:
except:
- gh-pages

notifications:
email: false

sudo: false

cache:
directories:
- $HOME/.m2
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ or Gradle:
```groovy
compile 'com.squareup.retrofit:retrofit:1.8.0'
```

Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].

Retrofit requires at minimum Java 6 or Android 2.3.



License
=======

Expand All @@ -44,3 +48,4 @@ License

[1]: http://square.github.io/retrofit/
[2]: https://search.maven.org/remote_content?g=com.squareup.retrofit&a=retrofit&v=LATEST
[snap]: https://oss.sonatype.org/content/repositories/snapshots/

0 comments on commit a38b6be

Please sign in to comment.