mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
43 lines
1.6 KiB
Bash
Executable File
43 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -ex
|
|
|
|
BASE_DIR=$(dirname "$(readlink -f "$0")")
|
|
BUILD_DIR="${BASE_DIR}/../build"
|
|
PUBLISH_DIR="${BASE_DIR}/../publish"
|
|
BASE_DOMAIN="${BASE_DOMAIN:-content.clickhouse.com}"
|
|
GIT_PROD_URI="${GIT_PROD_URI:-git@github.com:ClickHouse/clickhouse-com-content.git}"
|
|
EXTRA_BUILD_ARGS="${EXTRA_BUILD_ARGS:---verbose}"
|
|
|
|
if [[ -z "$1" ]]
|
|
then
|
|
source "${BASE_DIR}/venv/bin/activate"
|
|
# shellcheck disable=2086
|
|
python3 "${BASE_DIR}/build.py" ${EXTRA_BUILD_ARGS}
|
|
rm -rf "${PUBLISH_DIR}"
|
|
mkdir "${PUBLISH_DIR}" && cd "${PUBLISH_DIR}"
|
|
|
|
# Will make a repository with website content as the only commit.
|
|
git init
|
|
git remote add origin "${GIT_PROD_URI}"
|
|
git config user.email "robot-clickhouse@users.noreply.github.com"
|
|
git config user.name "robot-clickhouse"
|
|
|
|
# Add files.
|
|
cp -R "${BUILD_DIR}"/* .
|
|
echo -n "${BASE_DOMAIN}" > CNAME
|
|
cat > README.md << 'EOF'
|
|
## This repo is the source for https://content.clickhouse.com
|
|
It's built in [the action](https://github.com/ClickHouse/ClickHouse/blob/master/.github/workflows/docs_release.yml) in the DocsRelease job.
|
|
EOF
|
|
echo -n "" > ".nojekyll"
|
|
cp "${BASE_DIR}/../../LICENSE" .
|
|
git add ./*
|
|
git add ".nojekyll"
|
|
|
|
git commit --quiet -m "Add new release at $(date)"
|
|
|
|
# Push to GitHub rewriting the existing contents.
|
|
# Sometimes it does not work with error message "! [remote rejected] master -> master (cannot lock ref 'refs/heads/master': is at 42a0f6b6b6c7be56a469441b4bf29685c1cebac3 but expected 520e9b02c0d4678a2a5f41d2f561e6532fb98cc1)"
|
|
for _ in {1..10}; do git push --force origin master && break; sleep 5; done
|
|
fi
|