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 | # Get the directory of the current script when not running under |
| 9 | # Bazel (as indicated by the lack of BUILD_WORKSPACE_DIRECTORY). |
| 10 | DOCS_WORKSPACE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" |
| 11 | fi |
| 12 | |
| 13 | pushd "${DOCS_WORKSPACE}" &> /dev/null |
| 14 | # It's important to clean the workspace so we don't end up with unintended |
| 15 | # docs artifacts in the new commit. |
| 16 | bazel clean \ |
| 17 | && bazel build //... \ |
| 18 | && cp bazel-bin/*.md . \ |
| 19 | && chmod 0644 *.md |
| 20 | |
| 21 | if [ -n "$(git status --porcelain)" ]; then |
Adam Snaider | 1c095c9 | 2023-07-08 02:09:58 -0400 | [diff] [blame^] | 22 | >&2 git status |
| 23 | >&2 echo '/docs is out of date. Please run `./docs/update_docs.sh` from the root of rules_rust and push the results' >&2 |
Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame] | 24 | exit 1 |
| 25 | fi |
| 26 | |
| 27 | popd &> /dev/null |