#!/bin/bash

set -euo pipefail

# Make sure that our locale settings support UTF-8 in order for mkdocs and
# click to work.
export LC_ALL=C.UTF-8
export LANG=C.UTF-8

builtin cd "$(dirname "${BASH_SOURCE[0]}")"
site_dir=$(mktemp --directory)

bazel run //hap_documentation:mkdocs -- build --site-dir "$site_dir"

# Upload it to ZWeb and delete any files that no longer exist.
aws s3 sync --delete "$site_dir" s3://zoox-web/hapdocs/
