|
1 | 1 | #!/bin/bash |
2 | | -# Copyright 2018, Google Inc. All rights reserved. |
| 2 | +# Copyright 2019 Google Inc. |
3 | 3 | # |
4 | | -# Redistribution and use in source and binary forms, with or without |
5 | | -# modification, are permitted provided that the following conditions are |
6 | | -# met: |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
7 | 7 | # |
8 | | -# * Redistributions of source code must retain the above copyright |
9 | | -# notice, this list of conditions and the following disclaimer. |
10 | | -# * Redistributions in binary form must reproduce the above |
11 | | -# copyright notice, this list of conditions and the following disclaimer |
12 | | -# in the documentation and/or other materials provided with the |
13 | | -# distribution. |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
14 | 9 | # |
15 | | -# * Neither the name of Google Inc. nor the names of its |
16 | | -# contributors may be used to endorse or promote products derived from |
17 | | -# this software without specific prior written permission. |
18 | | -# |
19 | | -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
20 | | -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
21 | | -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 | | -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 | | -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 | | -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 | | -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 | | -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 | | -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 | | -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 | | -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +set -eo pipefail |
30 | 17 |
|
31 | | -set -e |
| 18 | +if [[ -z "${CREDENTIALS}" ]]; then |
| 19 | + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account |
| 20 | +fi |
32 | 21 |
|
33 | | -if [[ -z "${BUCKET}" ]]; then |
34 | | - echo "Must set BUCKET environment variable" |
35 | | - exit 1 |
| 22 | +if [[ -z "${STAGING_BUCKET}" ]]; then |
| 23 | + echo "Need to set STAGING_BUCKET environment variable" |
| 24 | + exit 1 |
36 | 25 | fi |
37 | 26 |
|
| 27 | +# work from the git root directory |
38 | 28 | pushd $(dirname "$0")/../../ |
39 | 29 |
|
40 | | -# Pull the library version from project properties |
41 | | -VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)') |
| 30 | +# install docuploader package |
| 31 | +python3 -m pip install gcp-docuploader |
42 | 32 |
|
43 | | -case "${VERSION}" in |
44 | | - *-SNAPSHOT) |
45 | | - echo "Cannot publish javadoc for -SNAPSHOT versions" |
46 | | - exit 1 |
47 | | - ;; |
48 | | - "") |
49 | | - echo "Could not obtain version number from maven-help-plugin." |
50 | | - exit 1 |
51 | | - ;; |
52 | | -esac |
| 33 | +# compile all packages |
| 34 | +mvn clean install -B -DskipTests=true |
53 | 35 |
|
54 | | -# Generate the javadoc from scratch |
55 | | -mvn clean install javadoc:aggregate -DskipTests=true -B |
| 36 | +NAME=google-auth-library |
| 37 | +VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) |
56 | 38 |
|
57 | | -# Sync the current version to gCS |
58 | | -gsutil -m rsync -d target/site gs://${BUCKET}/java/google-auth-library-java/${VERSION} |
| 39 | +# build the docs |
| 40 | +mvn site -B |
59 | 41 |
|
60 | | -if [[ "${LINK_LATEST}" == "true" ]]; then |
61 | | - # Sync the current content to latest |
62 | | - gsutil -m rsync gs://${BUCKET}/java/google-auth-library-java/${VERSION} gs://${BUCKET}/java/google-auth-library-java/latest |
63 | | -fi |
| 42 | +pushd target/site/apidocs |
| 43 | + |
| 44 | +# create metadata |
| 45 | +python3 -m docuploader create-metadata \ |
| 46 | + --name ${NAME} \ |
| 47 | + --version ${VERSION} \ |
| 48 | + --language java |
| 49 | + |
| 50 | +# upload docs |
| 51 | +python3 -m docuploader upload . \ |
| 52 | + --credentials ${CREDENTIALS} \ |
| 53 | + --staging-bucket ${STAGING_BUCKET} |
64 | 54 |
|
65 | 55 | popd |
0 commit comments