blob: edadbfab35cc125a76c7d9222aed402b7c94d4f0 [file] [log] [blame]
James Leitch978d7a02023-12-27 10:28:11 -07001#!/usr/bin/env bash
Damien Martin-Guillereza37e0f42020-06-30 12:05:23 +02002
UebelAndre1c3907d2021-04-07 08:46:31 -07003set -euo pipefail
4
5if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
6 DOCS_WORKSPACE="${BUILD_WORKSPACE_DIRECTORY}"
7else
8 # https://stackoverflow.com/a/246128/7768383
9 DOCS_WORKSPACE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
10fi
11
12pushd "${DOCS_WORKSPACE}" &> /dev/null
UebelAndre7d9e8902020-09-09 12:15:01 -070013# It's important to clean the workspace so we don't end up with unintended
14# docs artifacts in the new commit.
15bazel clean \
16&& bazel build //... \
17&& cp bazel-bin/*.md . \
UebelAndre27883572021-05-05 08:10:07 -070018&& chmod 0644 *.md
Damien Martin-Guillereza37e0f42020-06-30 12:05:23 +020019
UebelAndre27883572021-05-05 08:10:07 -070020if [[ -z "${SKIP_COMMIT:-}" ]]; then
21 git add *.md && git commit -m "Regenerate documentation"
22fi
23
24popd &> /dev/null