Skip to content

Commit

Permalink
Merge pull request #151 from ajkannan/modify-site-generation
Browse files Browse the repository at this point in the history
Push to gh-pages without using maven's site-deploy
  • Loading branch information
aozarov committed Aug 31, 2015
2 parents 9253778 + c0cadb7 commit 9d3b525
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 33 deletions.
21 changes: 1 addition & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<site>
<id>github-pages-site</id>
<name>Deployment through GitHub's site deployment plugin</name>
<url>site/${project.version}/</url>
<url>${project.version}/</url>
</site>
</distributionManagement>
<licenses>
Expand Down Expand Up @@ -372,25 +372,6 @@
</reportPlugins>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
<configuration>
<message>Creating site for ${project.artifactId} ${project.version}</message>
<path>${project.distributionManagement.site.url}</path>
<merge>true</merge>
</configuration>
<executions>
<execution>
<id>github-site</id>
<goals>
<goal>site</goal>
</goals>
<phase>site-deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
23 changes: 10 additions & 13 deletions utilities/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,22 @@ 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

# 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
# Deploy site if not a SNAPSHOT
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
mkdir -p tmp_gh-pages/$SITE_VERSION
mvn site -DskipTests=true
mvn site:stage -DtopSiteURL=http://googlecloudplatform.github.io/gcloud-java/site/${SITE_VERSION}/
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"
cp -r ../target/staging/$SITE_VERSION/* $SITE_VERSION/
sed -i "s/{{SITE_VERSION}}/$SITE_VERSION/g" ${SITE_VERSION}/index.html # Update "Quickstart with Maven" to reflect version change
git add $SITE_VERSION
echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL='http://GoogleCloudPlatform.github.io/gcloud-java/${SITE_VERSION}/index.html'\" /></head><body></body></html>" > index.html
git add index.html
git commit -m "Added a new site for version $SITE_VERSION and updated the root directory's redirect."
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
else
Expand Down

0 comments on commit 9d3b525

Please sign in to comment.