#!/bin/bash
echo "Building Autogenerated API Docs"
pushd ..
python -m biblio.cli ../disco/.biblio.yaml
popd

echo "Running Gitbook Build"
gitbook build

if [ ! -z "${GH_TOKEN:-}" ]; then
  echo "Deploying to Github Pages"
  pushd _book/
  git init
  git config user.name "AutoDoc"
  git config user.email "<>"
  git add .
  git commit -m "Generated Documentation"
  git push --force --quiet "https://${GH_TOKEN}@github.com/b1naryth1ef/disco" master:gh-pages
  popd
fi