#!/bin/bash
set -euo pipefail

# Make sure that our locale settings support UTF-8 to avoid unexpected issues
export LC_ALL=C.UTF-8
export LANG=C.UTF-8

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

echo "Building to $site_dir"
bazel run //ci/zimbeast/docs:run_sphinx -- $site_dir

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

