|
| 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 | + |
| 32 | +set -e |
| 33 | + |
| 34 | +VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)') |
| 35 | + |
| 36 | +if [ -z "$VERSION" ]; then |
| 37 | + echo "Error updating Javadoc: could not obtain version number from maven-help-plugin." |
| 38 | + exit 1 |
| 39 | +fi |
| 40 | + |
| 41 | +git clone --branch gh-pages --single-branch https://github.com/google/google-auth-library-java/ tmp_gh-pages |
| 42 | +mkdir -p tmp_gh-pages/releases/$VERSION |
| 43 | + |
| 44 | +mvn javadoc:aggregate |
| 45 | + |
| 46 | +pushd tmp_gh-pages/ |
| 47 | +cp -r ../target/site/* releases/$VERSION/ |
| 48 | +git add releases/$VERSION |
| 49 | + |
| 50 | +echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL='http://google.github.io/google-auth-library-java/releases/${VERSION}/apidocs/index.html'\" /></head><body></body></html>" > index.html |
| 51 | +git add index.html |
| 52 | + |
| 53 | +git commit --quiet -m "Add version $VERSION and update root redirect [ci skip]" |
| 54 | +git push |
| 55 | + |
| 56 | +popd |
| 57 | +rm -rf tmp_gh-pages |
0 commit comments