#!/usr/bin/env bash
set -euo pipefail

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

if git diff --cached --quiet -- docs/artist-guide; then
  exit 0
fi

if ! command -v python3 >/dev/null 2>&1; then
  echo "ERROR: python3 is required to refresh artist guide dates." >&2
  exit 1
fi

scripts/codex/build-artist-guide.sh
git add \
  docs/artist-guide/index.source.html \
  docs/artist-guide/index.en.source.html \
  docs/index.html \
  docs/index.en.html
