Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -euo pipefail |
| 4 | |
| 5 | if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then |
| 6 | DOCS_WORKSPACE="${BUILD_WORKSPACE_DIRECTORY}" |
| 7 | else |
| 8 | # https://stackoverflow.com/a/246128/7768383 |
| 9 | DOCS_WORKSPACE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" |
| 10 | fi |
| 11 | |
| 12 | pushd "${DOCS_WORKSPACE}" &> /dev/null |
| 13 | # It's important to clean the workspace so we don't end up with unintended |
| 14 | # docs artifacts in the new commit. |
| 15 | bazel clean \ |
| 16 | && bazel build //... \ |
| 17 | && cp bazel-bin/*.md . \ |
| 18 | && chmod 0644 *.md |
| 19 | |
| 20 | if [[ -z "${SKIP_COMMIT:-}" ]]; then |
| 21 | git add *.md && git commit -m "Regenerate documentation" |
| 22 | fi |
| 23 | |
| 24 | popd &> /dev/null |