|
| 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 | +# 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 | +#!/bin/bash |
| 17 | + |
| 18 | +set -eo pipefail |
| 19 | + |
| 20 | +# Disable buffering, so that the logs stream through. |
| 21 | +export PYTHONUNBUFFERED=1 |
| 22 | + |
| 23 | +cd github/python-asset |
| 24 | + |
| 25 | +# Remove old nox |
| 26 | +python3.6 -m pip uninstall --yes --quiet nox-automation |
| 27 | + |
| 28 | +# Install nox |
| 29 | +python3.6 -m pip install --upgrade --quiet nox |
| 30 | +python3.6 -m nox --version |
| 31 | + |
| 32 | +# build docs |
| 33 | +nox -s docs |
| 34 | + |
| 35 | +python3 -m pip install gcp-docuploader |
| 36 | + |
| 37 | +# install a json parser |
| 38 | +sudo apt-get update |
| 39 | +sudo apt-get -y install software-properties-common |
| 40 | +sudo add-apt-repository universe |
| 41 | +sudo apt-get update |
| 42 | +sudo apt-get -y install jq |
| 43 | + |
| 44 | +# create metadata |
| 45 | +python3 -m docuploader create-metadata \ |
| 46 | + --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \ |
| 47 | + --version=$(python3 setup.py --version) \ |
| 48 | + --language=$(jq --raw-output '.language // empty' .repo-metadata.json) \ |
| 49 | + --distribution-name=$(python3 setup.py --name) \ |
| 50 | + --product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \ |
| 51 | + --github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \ |
| 52 | + --issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json) |
| 53 | + |
| 54 | +cat docs.metadata |
| 55 | + |
| 56 | +# upload docs |
| 57 | +python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket docs-staging |
0 commit comments