Tim Swast | d1f4e25 | 2020-01-30 15:04:02 -0600 | [diff] [blame] | 1 | #!/bin/bash |
noahdietz | 5abf802 | 2022-04-12 10:25:08 -0700 | [diff] [blame] | 2 | # Adapted from https://github.com/googleapis/google-cloud-python/blob/main/.kokoro/publish-docs.sh |
Tim Swast | d1f4e25 | 2020-01-30 15:04:02 -0600 | [diff] [blame] | 3 | |
| 4 | set -eo pipefail |
| 5 | |
| 6 | # Disable buffering, so that the logs stream through. |
| 7 | export PYTHONUNBUFFERED=1 |
| 8 | |
| 9 | cd github/protobuf/python |
| 10 | |
| 11 | # install package |
| 12 | sudo apt-get update |
| 13 | sudo apt-get -y install software-properties-common |
| 14 | sudo add-apt-repository universe |
| 15 | sudo apt-get update |
| 16 | sudo apt-get -y install unzip |
Deanna Garcia | 87ac465 | 2022-06-15 17:22:55 +0000 | [diff] [blame] | 17 | wget https://github.com/protocolbuffers/protobuf/releases/download/v21.1/protoc-21.1-linux-x86_64.zip |
| 18 | unzip protoc-21.1-linux-x86_64.zip bin/protoc |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame^] | 19 | mv bin/protoc ../protoc |
Dennis Shao | 8424042 | 2021-04-26 14:59:14 -0500 | [diff] [blame] | 20 | python3 -m venv venv |
Tim Swast | d1f4e25 | 2020-01-30 15:04:02 -0600 | [diff] [blame] | 21 | source venv/bin/activate |
| 22 | python setup.py install |
| 23 | |
| 24 | # install docs dependencies |
| 25 | python -m pip install -r docs/requirements.txt |
| 26 | |
| 27 | # build docs |
| 28 | cd docs |
| 29 | make html |
| 30 | cd .. |
| 31 | deactivate |
| 32 | |
Deanna Garcia | 87ac465 | 2022-06-15 17:22:55 +0000 | [diff] [blame] | 33 | python3 -m pip install protobuf==4.21.1 gcp-docuploader==0.6.3 |
Tim Swast | d1f4e25 | 2020-01-30 15:04:02 -0600 | [diff] [blame] | 34 | |
| 35 | # install a json parser |
| 36 | sudo apt-get -y install jq |
| 37 | |
| 38 | # create metadata |
Dennis Shao | 8424042 | 2021-04-26 14:59:14 -0500 | [diff] [blame] | 39 | python3 -m docuploader create-metadata \ |
Tim Swast | d1f4e25 | 2020-01-30 15:04:02 -0600 | [diff] [blame] | 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 | |
| 48 | cat docs.metadata |
| 49 | |
| 50 | # upload docs |
Dennis Shao | 8424042 | 2021-04-26 14:59:14 -0500 | [diff] [blame] | 51 | python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket docs-staging |