...

Text file src/cloud.google.com/go/internal/kokoro/publish_docs.sh

Documentation: cloud.google.com/go/internal/kokoro

     1#!/bin/bash
     2# Copyright 2020 Google LLC
     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# Fail on any error.
    17set -eo pipefail
    18
    19# Display commands being run.
    20set -x
    21
    22cd github/google-cloud-go/internal/godocfx
    23go install -buildvcs=false
    24cd -
    25
    26# Use the google-cloud-go service account to store godocfx state.
    27export GOOGLE_APPLICATION_CREDENTIALS=$KOKORO_KEYSTORE_DIR/72523_go_integration_service_account
    28# Keep GCLOUD_TESTS_GOLANG_PROJECT_ID in sync with continuous.sh.
    29export GCLOUD_TESTS_GOLANG_PROJECT_ID=dulcet-port-762
    30
    31if [[ -n "$FORCE_GENERATE_ALL" ]]; then
    32  for m in $(find . -name go.mod -execdir go list -m \; | grep -v internal); do
    33    godocfx -out obj/api/$m@latest $m
    34  done
    35elif [[ -n "$MODULE" ]]; then
    36  godocfx "$MODULE"
    37else
    38  godocfx -project $GCLOUD_TESTS_GOLANG_PROJECT_ID -new-modules cloud.google.com/go google.golang.org/appengine
    39fi
    40
    41# Use the docuploader service account to upload docs.
    42gcloud auth activate-service-account --key-file "$KOKORO_KEYSTORE_DIR/73713_docuploader_service_account"
    43
    44for f in $(find obj/api -name docs.metadata); do
    45  # Extract the module name and version from the docs.metadata file.
    46  module=$(cat $f  | grep name    | sed 's/.*"\(.*\)"/\1/')
    47  version=$(cat $f | grep version | sed 's/.*"\(.*\)"/\1/')
    48  name="docfx-go-$module-$version.tar.gz"
    49  tar_dir=$(dirname $name)
    50  mkdir -p $tar_dir
    51  tar \
    52    --create \
    53    --directory=$(dirname $f) \
    54    --file=$name \
    55    --gzip \
    56    .
    57  gsutil cp $name gs://docs-staging-v2/$tar_dir
    58done

View as plain text