@@ -8,8 +8,30 @@ echo "Travis pull request: " ${TRAVIS_PULL_REQUEST}
8
8
echo " Travis JDK version: " ${TRAVIS_JDK_VERSION}
9
9
if [ " ${TRAVIS_JDK_VERSION} " == " oraclejdk7" -a " ${TRAVIS_BRANCH} " == " master" -a " ${TRAVIS_PULL_REQUEST} " == " false" ]; then
10
10
mvn cobertura:cobertura coveralls:report
11
- mvn site-deploy -DskipTests=true --settings=target/travis/settings.xml
12
11
mvn deploy -DskipTests=true -Dgpg.skip=true --settings target/travis/settings.xml
12
+
13
+ # Deploy site if not a SNAPSHOT
14
+ SITE_VERSION=$( mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev ' (^\[|\w+:)' )
15
+ if [ " ${SITE_VERSION##* -} " != " SNAPSHOT" ]; then
16
+ mvn site-deploy -DskipTests=true --settings=target/travis/settings.xml
17
+
18
+ # Update "latest" webpage
19
+ git config --global user.name " travis-ci"
20
+ git config --global user.email
" [email protected] "
21
+ git clone --branch gh-pages --single-branch https://github.com/GoogleCloudPlatform/gcloud-java/ tmp_gh-pages
22
+ cd tmp_gh-pages
23
+ mkdir -p site/latest/
24
+ echo " <html><head><meta http-equiv=\" refresh\" content=\" 0; URL='http://GoogleCloudPlatform.github.io/gcloud-java/site/${SITE_VERSION} /index.html'\" /></head><body></body></html>" > site/latest/index.html
25
+ git add site/latest/index.html
26
+
27
+ # Update "Quickstart with Maven" block on landing page to reflect latest version
28
+ sed -i " s/{{SITE_VERSION}}/$SITE_VERSION /g" site/${SITE_VERSION} /index.html
29
+ git add site/${SITE_VERSION} /index.html
30
+
31
+ git commit -m " Update the redirect in 'latest/index.html' and the version in the 'Quickstart with Maven' landing page box to $SITE_VERSION "
32
+ git config --global push.default simple
33
+ git push --quiet " https://${CI_DEPLOY_USERNAME} :${CI_DEPLOY_PASSWORD} @github.com/GoogleCloudPlatform/gcloud-java.git" > /dev/null 2>&1
34
+ fi
13
35
else
14
36
echo " Not deploying artifacts. This is only done with non-pull-request commits to master branch with Oracle Java 7 builds."
15
37
fi
0 commit comments