From 63d01ce437641850633c63bdcbf9720489413698 Mon Sep 17 00:00:00 2001 From: Ajay Kannan Date: Mon, 24 Aug 2015 09:56:35 -0700 Subject: [PATCH 1/4] 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. --- src/site/resources/index.html | 2 +- utilities/after_success.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/site/resources/index.html b/src/site/resources/index.html index fc638aed3ce6..fd7209dfdc80 100644 --- a/src/site/resources/index.html +++ b/src/site/resources/index.html @@ -62,7 +62,7 @@

Quickstart with Maven: Add gcloud to your pom.xml

<dependency>
   <groupId>com.google.gcloud</groupId>
   <artifactId>gcloud-java</artifactId>
-  <version>0.0.6</version>
+  <version>{{SITE_VERSION}}</version>
 </dependency>
diff --git a/utilities/after_success.sh b/utilities/after_success.sh index a0d9200681e4..f74c12413bdd 100755 --- a/utilities/after_success.sh +++ b/utilities/after_success.sh @@ -10,6 +10,28 @@ if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" -a "${TRAVIS_BRANCH}" == "master" - 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 + + # Update "site/latest/index.html" to redirect to the newly generated website (if not a SNAPSHOT) + git config --global user.name "travis-ci" + git config --global user.email "travis@travis-ci.org" + git clone https://github.com/GoogleCloudPlatform/gcloud-java.git tmp_gh-pages + cd tmp_gh-pages + 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 + git checkout gh-pages + mkdir -p site/latest/ + touch site/latest/index.html + echo "" > 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" + 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 From d2f41285f09c2f2b1ed85eb323f378fe530de3bd Mon Sep 17 00:00:00 2001 From: Ajay Kannan Date: Mon, 24 Aug 2015 13:53:49 -0700 Subject: [PATCH 2/4] Only deploy the site and version updates if not a snapshot release --- utilities/after_success.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/utilities/after_success.sh b/utilities/after_success.sh index f74c12413bdd..a034898b1b79 100755 --- a/utilities/after_success.sh +++ b/utilities/after_success.sh @@ -8,17 +8,18 @@ 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 - # Update "site/latest/index.html" to redirect to the newly generated website (if not a SNAPSHOT) - git config --global user.name "travis-ci" - git config --global user.email "travis@travis-ci.org" - git clone https://github.com/GoogleCloudPlatform/gcloud-java.git tmp_gh-pages - cd tmp_gh-pages + # 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 - git checkout gh-pages + 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 "travis@travis-ci.org" + 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 echo "" > site/latest/index.html From 3a5d6388a28006808e021b7bb0d83d900af72274 Mon Sep 17 00:00:00 2001 From: Ajay Kannan Date: Mon, 24 Aug 2015 15:28:40 -0700 Subject: [PATCH 3/4] minor update to commit message --- utilities/after_success.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utilities/after_success.sh b/utilities/after_success.sh index a034898b1b79..a7ff896500c5 100755 --- a/utilities/after_success.sh +++ b/utilities/after_success.sh @@ -21,7 +21,6 @@ if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" -a "${TRAVIS_BRANCH}" == "master" - 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 echo "" > site/latest/index.html git add site/latest/index.html @@ -29,7 +28,7 @@ if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" -a "${TRAVIS_BRANCH}" == "master" - 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" + 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 From 8c4fd41ccf63ab2ef8ab3fdd2167d5971c30239e Mon Sep 17 00:00:00 2001 From: Ajay Kannan Date: Mon, 24 Aug 2015 15:40:49 -0700 Subject: [PATCH 4/4] removing extraneous piece of regex to find version number --- utilities/after_success.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/after_success.sh b/utilities/after_success.sh index a7ff896500c5..2b39d8d91464 100755 --- a/utilities/after_success.sh +++ b/utilities/after_success.sh @@ -11,7 +11,7 @@ if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" -a "${TRAVIS_BRANCH}" == "master" - 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+:)') + 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