2022-04-14 22:38:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2022-04-29 13:23:16 +00:00
|
|
|
GIT_BRANCH=$(git branch --show-current)
|
|
|
|
|
|
|
|
if [ "$GIT_DOCS_BRANCH" ] && ! [ "$GIT_DOCS_BRANCH" == "$GIT_BRANCH" ]; then
|
|
|
|
git fetch origin --depth=1 -- "$GIT_DOCS_BRANCH:$GIT_DOCS_BRANCH"
|
2022-04-19 21:35:39 +00:00
|
|
|
git checkout "$GIT_DOCS_BRANCH"
|
|
|
|
else
|
|
|
|
# Update docs repo
|
|
|
|
git pull
|
|
|
|
fi
|
2022-04-14 22:38:16 +00:00
|
|
|
|
|
|
|
# The repo is usually mounted to /ClickHouse
|
2024-12-05 08:02:43 +00:00
|
|
|
LANGUAGES=$(grep -o "'[/][a-z][a-z]'" /opt/clickhouse-docs/docusaurus.config.js | sort -u | sed "s/'\/\([a-z][a-z]\)'/\1/")
|
2022-04-14 22:38:16 +00:00
|
|
|
|
2024-12-05 08:02:43 +00:00
|
|
|
for lang in $LANGUAGES
|
2022-04-14 22:38:16 +00:00
|
|
|
do
|
2022-04-15 16:12:11 +00:00
|
|
|
if [ -d "/ClickHouse/docs/${lang}" ]; then
|
|
|
|
cp -rf "/ClickHouse/docs/${lang}" "/opt/clickhouse-docs/docs/"
|
2022-04-14 22:38:16 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2022-04-15 14:07:55 +00:00
|
|
|
# Force build error on wrong symlinks
|
|
|
|
sed -i '/onBrokenMarkdownLinks:/ s/ignore/error/g' docusaurus.config.js
|
|
|
|
|
2022-04-14 22:38:16 +00:00
|
|
|
if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
|
2023-02-06 14:12:29 +00:00
|
|
|
export CI=true
|
2022-04-14 22:38:16 +00:00
|
|
|
exec yarn build "$@"
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec "$@"
|