aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorChristian Edward Gruber <cgruber@google.com>2015-02-24 09:57:16 -0800
committerChristian Edward Gruber <cgruber@google.com>2015-02-24 12:22:06 -0800
commite0c9a211037a55166c48ccd3ccbf600d22d92687 (patch)
treeaaf476e38de4e58c418088ca03dbb54f26f0f6f1 /util
parent6bc3e3b2d3581959dce000e805ed64046e07e4ef (diff)
downloadauto-e0c9a211037a55166c48ccd3ccbf600d22d92687.tar.gz
Add travis configuration, secure variables, and scripts suitable to add automatic snapshot and javadoc publishing on a successful build.
Diffstat (limited to 'util')
-rwxr-xr-xutil/generate-latest-docs.sh25
-rwxr-xr-xutil/publish-snapshot-on-commit.sh12
-rw-r--r--util/settings.xml9
3 files changed, 46 insertions, 0 deletions
diff --git a/util/generate-latest-docs.sh b/util/generate-latest-docs.sh
new file mode 100755
index 00000000..34ff5fb8
--- /dev/null
+++ b/util/generate-latest-docs.sh
@@ -0,0 +1,25 @@
+# see http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/ for details
+
+if [ "$TRAVIS_REPO_SLUG" == "google/truth" ] && \
+ [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && \
+ [ "$TRAVIS_PULL_REQUEST" == "false" ] && \
+ [ "$TRAVIS_BRANCH" == "master" ]; then
+ echo -e "Publishing javadoc...\n"
+
+ mvn -f build-pom.xml javadoc:aggregate
+ TARGET="$(pwd)/target"
+
+ cd $HOME
+ git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/google/truth gh-pages > /dev/null
+
+ cd gh-pages
+ git config --global user.email "travis@travis-ci.org"
+ git config --global user.name "travis-ci"
+ git rm -rf api/latest
+ mv ${TARGET}/site/apidocs api/latest
+ git add -A -f api/latest
+ git commit -m "Lastest javadoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages"
+ git push -fq origin gh-pages > /dev/null
+
+ echo -e "Published Javadoc to gh-pages.\n"
+fi
diff --git a/util/publish-snapshot-on-commit.sh b/util/publish-snapshot-on-commit.sh
new file mode 100755
index 00000000..e85afb5f
--- /dev/null
+++ b/util/publish-snapshot-on-commit.sh
@@ -0,0 +1,12 @@
+# see https://coderwall.com/p/9b_lfq
+
+if [ "$TRAVIS_REPO_SLUG" == "google/truth" ] && \
+ [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && \
+ [ "$TRAVIS_PULL_REQUEST" == "false" ] && \
+ [ "$TRAVIS_BRANCH" == "master" ]; then
+ echo -e "Publishing maven snapshot...\n"
+
+ mvn -f build-pom.xml clean source:jar deploy --settings="util/settings.xml" -DskipTests=true -Dmaven.javadoc.skip=true
+
+ echo -e "Published maven snapshot"
+fi
diff --git a/util/settings.xml b/util/settings.xml
new file mode 100644
index 00000000..91f444b2
--- /dev/null
+++ b/util/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>