blob: 8acb14e802b0669f4855815db734226e01e6e77d [file] [log] [blame]
Bu Sun Kime72202e2020-02-19 17:58:47 -08001#!/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# 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
Bu Sun Kime72202e2020-02-19 17:58:47 -080016set -eo pipefail
17
18# Disable buffering, so that the logs stream through.
19export PYTHONUNBUFFERED=1
20
Tres Seaver000d0a02020-10-06 15:47:28 -040021export PATH="${HOME}/.local/bin:${PATH}"
Bu Sun Kime72202e2020-02-19 17:58:47 -080022
23# Install nox
Tres Seaver000d0a02020-10-06 15:47:28 -040024python3 -m pip install --user --upgrade --quiet nox
25python3 -m nox --version
Bu Sun Kime72202e2020-02-19 17:58:47 -080026
27# build docs
28nox -s docs
29
Tres Seaver000d0a02020-10-06 15:47:28 -040030python3 -m pip install --user gcp-docuploader
Bu Sun Kime72202e2020-02-19 17:58:47 -080031
32# create metadata
33python3 -m docuploader create-metadata \
34 --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
35 --version=$(python3 setup.py --version) \
36 --language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
37 --distribution-name=$(python3 setup.py --name) \
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
42cat docs.metadata
43
44# upload docs
Tres Seaver000d0a02020-10-06 15:47:28 -040045python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket "${STAGING_BUCKET}"
46
47
48# docfx yaml files
49nox -s docfx
50
51# create metadata.
52python3 -m docuploader create-metadata \
53 --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
54 --version=$(python3 setup.py --version) \
55 --language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
56 --distribution-name=$(python3 setup.py --name) \
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
61cat docs.metadata
62
63# upload docs
64python3 -m docuploader upload docs/_build/html/docfx_yaml --metadata-file docs.metadata --destination-prefix docfx --staging-bucket "${V2_STAGING_BUCKET}"