Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-deploy snapshots from Travis CI to Sonatype. #6

Merged
merged 1 commit into from Dec 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions .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="JakeWharton/flip-tables"
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
9 changes: 9 additions & 0 deletions .buildscript/settings.xml
@@ -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>
23 changes: 20 additions & 3 deletions .travis.yml
@@ -1,9 +1,26 @@
language: java

jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
- oraclejdk7
- oraclejdk8

after_success:
- .buildscript/deploy_snapshot.sh

env:
global:
- secure: "PonNNNNiIRXghjef4hsEfIz7LGYzDaET8n4nQHou0+FI2UGrjii56MQwdkHhekipzD+XOXEo46Tw1z588mmsxqe3vTQY2q0hrR2RGXqc2vXCv4FlxQzrtpbeW1chbawCI9tOS4WT92uh/ovoXvIo3WrgG6sJAn//NPPbEwVutN0="
- secure: "hi1G/aAjxr8nim+rHTPMjR2YfX76SbnfRi28SF+TmGl1wAPxGu06dJfNq8zoqMGY0nCQWkHLNd+YOXZPf7HQt5DCcIhiiisy3Tc13vAtXjbDuYYPKbk/bh+fgTYI5T6XMHUc9DzYtKAtNTUNxZIhhPq2DhWocrMXwt47cg76tyY="

branches:
except:
- gh-pages

notifications:
email: false

sudo: false

cache:
directories:
- $HOME/.m2
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -140,6 +140,8 @@ Download
Download the [latest jar][1] or reference on Maven central as
`com.jakewharton.fliptables:fliptables:1.0.2`.

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



License
Expand All @@ -162,3 +164,4 @@ License


[1]: https://search.maven.org/remote_content?g=com.jakewharton.fliptables&a=fliptables&v=LATEST
[snap]: https://oss.sonatype.org/content/repositories/snapshots/