Skip to content

Commit cd4d635

Browse files
authored
Add Kokoro config and script for building current structure of javadocs (#4985)
Use a bash function to avoid repetition Enable all steps
1 parent d931fac commit cd4d635

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
env_vars: {
3+
key: "STAGING_BUCKET"
4+
value: "docs_staging"
5+
}
6+
7+
env_vars: {
8+
key: "TRAMPOLINE_BUILD_FILE"
9+
value: "github/google-cloud-java/.kokoro/release/publish_javadoc.sh"
10+
}
11+
12+
before_action {
13+
fetch_keystore {
14+
keystore_resource {
15+
keystore_config_id: 73713
16+
keyname: "docuploader_service_account"
17+
}
18+
}
19+
}

.kokoro/release/publish_javadoc.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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

Comments
 (0)