|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2024 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 | +# https://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 | +# Disable buffering, so that the logs stream through. |
| 19 | +export PYTHONUNBUFFERED=1 |
| 20 | + |
| 21 | +export PATH="${HOME}/.local/bin:${PATH}" |
| 22 | + |
| 23 | +# Install nox |
| 24 | +python3 -m pip install --require-hashes -r .kokoro/requirements.txt |
| 25 | +python3 -m nox --version |
| 26 | + |
| 27 | +# build docs |
| 28 | +nox -s docs |
| 29 | + |
| 30 | +VERSION=$(python -c "import langchain_google_spanner;print(langchain_google_spanner.__version__)") |
| 31 | + |
| 32 | +# create metadata |
| 33 | +python3 -m docuploader create-metadata \ |
| 34 | + --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \ |
| 35 | + --version=$VERSION \ |
| 36 | + --language=$(jq --raw-output '.language // empty' .repo-metadata.json) \ |
| 37 | + --distribution-name=$(yq -oy '.project.name' pyproject.toml) \ |
| 38 | + --product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \ |
| 39 | + --github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \ |
| 40 | + --issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json) |
| 41 | + |
| 42 | +cat docs.metadata |
| 43 | + |
| 44 | +# upload docs |
| 45 | +python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket "${STAGING_BUCKET}" |
| 46 | + |
| 47 | + |
| 48 | +# docfx yaml files |
| 49 | +nox -s docfx |
| 50 | + |
| 51 | +# create metadata. |
| 52 | +python3 -m docuploader create-metadata \ |
| 53 | + --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \ |
| 54 | + --version=$VERSION \ |
| 55 | + --language=$(jq --raw-output '.language // empty' .repo-metadata.json) \ |
| 56 | + --distribution-name=$(yq -oy '.project.name' pyproject.toml) \ |
| 57 | + --product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \ |
| 58 | + --github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \ |
| 59 | + --issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json) |
| 60 | + |
| 61 | +cat docs.metadata |
| 62 | + |
| 63 | +# upload docs |
| 64 | +python3 -m docuploader upload docs/_build/html/docfx_yaml --metadata-file docs.metadata --destination-prefix docfx --staging-bucket "${V2_STAGING_BUCKET}" |
0 commit comments