1+ #! /bin/bash
2+ # Copyright 2019 Google Inc.
3+ #
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+ #
8+ # http://www.apache.org/licenses/LICENSE-2.0
9+ #
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
17+
18+ if [[ -z " ${CREDENTIALS} " ]]; then
19+ CREDENTIALS=${KOKORO_KEYSTORE_DIR} /73713-docuploader_service_account
20+ fi
21+
22+ if [[ -z " ${STAGING_BUCKET} " ]]; then
23+ echo " Need to set STAGING_BUCKET environment variable"
24+ exit 1
25+ fi
26+
27+ # work from the git root directory
28+ pushd $( dirname " $0 " ) /../../
29+
30+ # install docuploader package
31+ python3 -m pip install gcp-docuploader
32+
33+ # compile all packages
34+ mvn clean install -B -DskipTests=true
35+
36+ build_and_publish_site () {
37+ DIRECTORY=$1
38+ NAME=$1
39+ VERSION=$( grep ${NAME} : versions.txt | cut -d: -f3)
40+
41+ pushd ${DIRECTORY}
42+
43+ # build the docs
44+ mvn site
45+ mvn site:stage -DtopSiteURL=https://googleapis.dev/java/${NAME} /${VERSION}
46+
47+ pushd target/staging/site/${NAME} /apidocs
48+
49+ # create metadata
50+ python3 -m docuploader create-metadata \
51+ --name ${NAME} \
52+ --version ${VERSION} \
53+ --language java
54+
55+ # upload docs
56+ python3 -m docuploader upload . \
57+ --credentials ${CREDENTIALS} \
58+ --staging-bucket ${STAGING_BUCKET}
59+
60+ popd
61+ popd
62+ }
63+
64+ # TODO (chingor): split all the artifacts
65+ build_and_publish_site google-api-grpc
66+ build_and_publish_site google-cloud-clients
0 commit comments