Skip to content

Commit 63d01ce

Browse files
author
Ajay Kannan
committed
Creating a latest webpage generated after Travis runs. This webpage provides a stable link for other sites to link to gcloud-java's landing page.
1 parent fa74584 commit 63d01ce

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/site/resources/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ <h2>Quickstart with Maven: Add gcloud to your pom.xml</h2>
6262
<pre>&lt;dependency&gt;
6363
&lt;groupId&gt;com.google.gcloud&lt;/groupId&gt;
6464
&lt;artifactId&gt;gcloud-java&lt;/artifactId&gt;
65-
&lt;version&gt;0.0.6&lt;/version&gt;
65+
&lt;version&gt;{{SITE_VERSION}}&lt;/version&gt;
6666
&lt;/dependency&gt;</pre>
6767
</div><!-- end of .col.col-right -->
6868
</div><!-- end of .container -->

utilities/after_success.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" -a "${TRAVIS_BRANCH}" == "master" -
1010
mvn cobertura:cobertura coveralls:report
1111
mvn site-deploy -DskipTests=true --settings=target/travis/settings.xml
1212
mvn deploy -DskipTests=true -Dgpg.skip=true --settings target/travis/settings.xml
13+
14+
# Update "site/latest/index.html" to redirect to the newly generated website (if not a SNAPSHOT)
15+
git config --global user.name "travis-ci"
16+
git config --global user.email "[email protected]"
17+
git clone https://github.com/GoogleCloudPlatform/gcloud-java.git tmp_gh-pages
18+
cd tmp_gh-pages
19+
SITE_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|Download\w+:)')
20+
if [ "${SITE_VERSION##*-}" != "SNAPSHOT" ]; then
21+
git checkout gh-pages
22+
mkdir -p site/latest/
23+
touch site/latest/index.html
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 "Updating to reflect latest website 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
1335
else
1436
echo "Not deploying artifacts. This is only done with non-pull-request commits to master branch with Oracle Java 7 builds."
1537
fi

0 commit comments

Comments
 (0)