• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Adapted from https://github.com/googleapis/google-cloud-python/blob/master/.kokoro/publish-docs.sh
3
4set -eo pipefail
5
6# Disable buffering, so that the logs stream through.
7export PYTHONUNBUFFERED=1
8
9cd github/protobuf/python
10
11# install package
12sudo apt-get update
13sudo apt-get -y install software-properties-common
14sudo add-apt-repository universe
15sudo apt-get update
16sudo apt-get -y install unzip
17wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.2/protoc-3.11.2-linux-x86_64.zip
18unzip protoc-3.11.2-linux-x86_64.zip bin/protoc
19mv bin/protoc ../src/protoc
20python3.6 -m venv venv
21source venv/bin/activate
22python setup.py install
23
24# install docs dependencies
25python -m pip install -r docs/requirements.txt
26
27# build docs
28cd docs
29make html
30cd ..
31deactivate
32
33python3.6 -m pip install protobuf==3.11.1 gcp-docuploader
34
35# install a json parser
36sudo apt-get -y install jq
37
38# create metadata
39python3.6 -m docuploader create-metadata \
40  --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
41  --version=$(python3 setup.py --version) \
42  --language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
43  --distribution-name=$(python3 setup.py --name) \
44  --product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \
45  --github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \
46  --issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json)
47
48cat docs.metadata
49
50# upload docs
51python3.6 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket docs-staging
52