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

Creating a latest webpage generated after Travis runs #139

Merged
merged 4 commits into from
Aug 24, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
25 changes: 24 additions & 1 deletion utilities/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,31 @@ 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 '(^\[|Download\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/
touch site/latest/index.html

This comment was marked as spam.

This comment was marked as spam.

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 "Updating to reflect latest website version"

This comment was marked as spam.

This comment was marked as spam.

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