1#!/bin/bash 2 3# Copyright 2017, Google Inc. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: 8# 9# * Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# * Redistributions in binary form must reproduce the above 12# copyright notice, this list of conditions and the following disclaimer 13# in the documentation and/or other materials provided with the 14# distribution. 15# 16# * Neither the name of Google Inc. nor the names of its 17# contributors may be used to endorse or promote products derived from 18# this software without specific prior written permission. 19# 20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 32set -e 33 34VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)') 35 36if [ -z "$VERSION" ]; then 37 echo "Error updating Javadoc: could not obtain version number from maven-help-plugin." 38 exit 1 39fi 40 41git clone --branch gh-pages --single-branch git@github.com:googleapis/google-auth-library-java.git tmp_gh-pages 42mkdir -p tmp_gh-pages/releases/$VERSION 43 44mvn javadoc:aggregate 45 46pushd tmp_gh-pages/ 47cp -r ../target/site/* releases/$VERSION/ 48git add releases/$VERSION 49 50# copy to latest 51rm -rf releases/latest 52cp -r releases/$VERSION releases/latest 53git add releases/latest 54 55echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL='http://googleapis.github.io/google-auth-library-java/releases/${VERSION}/apidocs/index.html'\" /></head><body></body></html>" > index.html 56git add index.html 57 58git commit --quiet -m "Add version $VERSION and update root redirect [ci skip]" 59git push 60 61popd 62rm -rf tmp_gh-pages 63