1*af546375SCole Faust#!/bin/bash 2*af546375SCole Faust# Copyright 2019 Google LLC 3*af546375SCole Faust# 4*af546375SCole Faust# Licensed under the Apache License, Version 2.0 (the "License"); 5*af546375SCole Faust# you may not use this file except in compliance with the License. 6*af546375SCole Faust# You may obtain a copy of the License at 7*af546375SCole Faust# 8*af546375SCole Faust# http://www.apache.org/licenses/LICENSE-2.0 9*af546375SCole Faust# 10*af546375SCole Faust# Unless required by applicable law or agreed to in writing, software 11*af546375SCole Faust# distributed under the License is distributed on an "AS IS" BASIS, 12*af546375SCole Faust# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*af546375SCole Faust# See the License for the specific language governing permissions and 14*af546375SCole Faust# limitations under the License. 15*af546375SCole Faust 16*af546375SCole Faustset -eo pipefail 17*af546375SCole Faust 18*af546375SCole Faustif [[ -z "${CREDENTIALS}" ]]; then 19*af546375SCole Faust CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account 20*af546375SCole Faustfi 21*af546375SCole Faust 22*af546375SCole Faustif [[ -z "${STAGING_BUCKET}" ]]; then 23*af546375SCole Faust echo "Need to set STAGING_BUCKET environment variable" 24*af546375SCole Faust exit 1 25*af546375SCole Faustfi 26*af546375SCole Faust 27*af546375SCole Faust# work from the git root directory 28*af546375SCole Faustpushd $(dirname "$0")/../../ 29*af546375SCole Faust 30*af546375SCole Faust# install docuploader package 31*af546375SCole Faustpython3 -m pip install --require-hashes -r .kokoro/requirements.txt 32*af546375SCole Faust 33*af546375SCole Faust# compile all packages 34*af546375SCole Faustmvn clean install -B -q -DskipTests=true 35*af546375SCole Faust 36*af546375SCole Faustexport NAME=google-auth-library 37*af546375SCole Faustexport VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) 38*af546375SCole Faust 39*af546375SCole Faust# build the docs 40*af546375SCole Faustmvn site -B -q 41*af546375SCole Faust 42*af546375SCole Faustpushd target/site/apidocs 43*af546375SCole Faust 44*af546375SCole Faust# create metadata 45*af546375SCole Faustpython3 -m docuploader create-metadata \ 46*af546375SCole Faust --name ${NAME} \ 47*af546375SCole Faust --version ${VERSION} \ 48*af546375SCole Faust --language java 49*af546375SCole Faust 50*af546375SCole Faust# upload docs 51*af546375SCole Faustpython3 -m docuploader upload . \ 52*af546375SCole Faust --credentials ${CREDENTIALS} \ 53*af546375SCole Faust --staging-bucket ${STAGING_BUCKET} 54