Skip to content

Commit

Permalink
Merge pull request #139 from ajkannan/latest-webpage-via-travis
Browse files Browse the repository at this point in the history
Creating a latest webpage generated after Travis runs
  • Loading branch information
ajkannan committed Aug 24, 2015
2 parents fa74584 + 8c4fd41 commit 8ead095
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/site/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h2>Quickstart with Maven: Add gcloud to your pom.xml</h2>
<pre>&lt;dependency&gt;
&lt;groupId&gt;com.google.gcloud&lt;/groupId&gt;
&lt;artifactId&gt;gcloud-java&lt;/artifactId&gt;
&lt;version&gt;0.0.6&lt;/version&gt;
&lt;version&gt;{{SITE_VERSION}}&lt;/version&gt;
&lt;/dependency&gt;</pre>
</div><!-- end of .col.col-right -->
</div><!-- end of .container -->
Expand Down
24 changes: 23 additions & 1 deletion utilities/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,30 @@ echo "Travis pull request: " ${TRAVIS_PULL_REQUEST}
echo "Travis JDK version: " ${TRAVIS_JDK_VERSION}
if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" -a "${TRAVIS_BRANCH}" == "master" -a "${TRAVIS_PULL_REQUEST}" == "false" ]; then
mvn cobertura:cobertura coveralls:report
mvn site-deploy -DskipTests=true --settings=target/travis/settings.xml
mvn deploy -DskipTests=true -Dgpg.skip=true --settings target/travis/settings.xml

# Deploy site if not a SNAPSHOT
SITE_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)')
if [ "${SITE_VERSION##*-}" != "SNAPSHOT" ]; then
mvn site-deploy -DskipTests=true --settings=target/travis/settings.xml

# Update "latest" webpage
git config --global user.name "travis-ci"
git config --global user.email "[email protected]"
git clone --branch gh-pages --single-branch https://github.com/GoogleCloudPlatform/gcloud-java/ tmp_gh-pages
cd tmp_gh-pages
mkdir -p site/latest/
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
git add site/latest/index.html

# Update "Quickstart with Maven" block on landing page to reflect latest version
sed -i "s/{{SITE_VERSION}}/$SITE_VERSION/g" site/${SITE_VERSION}/index.html
git add site/${SITE_VERSION}/index.html

git commit -m "Update the redirect in 'latest/index.html' and the version in the 'Quickstart with Maven' landing page box to $SITE_VERSION"
git config --global push.default simple
git push --quiet "https://${CI_DEPLOY_USERNAME}:${CI_DEPLOY_PASSWORD}@github.com/GoogleCloudPlatform/gcloud-java.git" > /dev/null 2>&1
fi
else
echo "Not deploying artifacts. This is only done with non-pull-request commits to master branch with Oracle Java 7 builds."
fi

0 comments on commit 8ead095

Please sign in to comment.