#!/bin/bash

# Builds the data catalog docs and uploads them to Zweb (data-catalog-docs).

set -euo pipefail

bucket='zoox-web'
site_name='data-catalog-docs'

cd "$( (builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) )"
repo_root="$(cd ../../../ && pwd)"

# This needs to be set to _something_ otherwise virtualenv fails hard because
# `set -u` is enabled.
PS1=''

virtualenv --python=/usr/bin/python2 "$repo_root"/third_party/venvs/catalog_backend
source "$repo_root"/third_party/venvs/catalog_backend/bin/activate
pip install --requirement "$repo_root"/infra/data_catalog/catalog_backend/requirements.txt

make html

aws s3 sync build/html "s3://$bucket/$site_name"
