2017-04-10 14:24:53 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
2020-01-21 14:36:12 +00:00
|
|
|
|
2017-04-10 14:24:53 +00:00
|
|
|
BASE_DIR=$(dirname $(readlink -f $0))
|
2019-03-26 09:50:28 +00:00
|
|
|
BUILD_DIR="${BASE_DIR}/../build"
|
2020-01-28 18:51:44 +00:00
|
|
|
PUBLISH_DIR="${BASE_DIR}/../publish"
|
2020-02-21 20:24:31 +00:00
|
|
|
TEST_DOMAIN="${TEST_DOMAIN:-clickhouse.tech}"
|
|
|
|
GIT_TEST_URI="${GIT_TEST_URI:-git@github.com:ClickHouse/clickhouse.github.io.git}"
|
2020-01-29 14:56:52 +00:00
|
|
|
GIT_PROD_URI="git@github.com:ClickHouse/clickhouse.github.io.git"
|
2020-02-21 20:24:31 +00:00
|
|
|
EXTRA_BUILD_ARGS="${EXTRA_BUILD_ARGS:---enable-stable-releases}"
|
2020-01-29 14:56:52 +00:00
|
|
|
|
2017-04-10 14:24:53 +00:00
|
|
|
if [[ -z "$1" ]]
|
|
|
|
then
|
|
|
|
TAG=$(head -c 8 /dev/urandom | xxd -p)
|
|
|
|
else
|
|
|
|
TAG="$1"
|
|
|
|
fi
|
2017-05-30 14:21:04 +00:00
|
|
|
DOCKER_HASH="$2"
|
2017-04-10 14:24:53 +00:00
|
|
|
if [[ -z "$1" ]]
|
|
|
|
then
|
2019-03-26 09:50:28 +00:00
|
|
|
source "${BASE_DIR}/venv/bin/activate"
|
2020-02-21 20:24:31 +00:00
|
|
|
python "${BASE_DIR}/build.py" ${EXTRA_BUILD_ARGS}
|
2020-01-28 18:51:44 +00:00
|
|
|
rm -rf "${PUBLISH_DIR}" || true
|
2020-01-29 14:56:52 +00:00
|
|
|
git clone "${GIT_TEST_URI}" "${PUBLISH_DIR}"
|
2020-01-28 18:51:44 +00:00
|
|
|
cd "${PUBLISH_DIR}"
|
2020-01-29 13:36:13 +00:00
|
|
|
git config user.email "robot-clickhouse@yandex-team.ru"
|
|
|
|
git config user.name "robot-clickhouse"
|
2020-01-28 18:51:44 +00:00
|
|
|
git rm -rf *
|
|
|
|
cp -R "${BUILD_DIR}"/* .
|
2020-02-21 20:24:31 +00:00
|
|
|
echo -n "${TEST_DOMAIN}" > CNAME
|
2020-01-28 19:47:58 +00:00
|
|
|
echo -n "" > README.md
|
2020-02-03 10:00:49 +00:00
|
|
|
echo -n "" > ".nojekyll"
|
2020-01-28 19:31:35 +00:00
|
|
|
cp "${BASE_DIR}/../../LICENSE" .
|
2020-01-28 18:51:44 +00:00
|
|
|
git add *
|
2020-02-03 10:00:49 +00:00
|
|
|
git add ".nojekyll"
|
2020-01-28 18:51:44 +00:00
|
|
|
git commit -a -m "add new release at $(date)"
|
|
|
|
git push origin master
|
2019-03-26 09:50:28 +00:00
|
|
|
cd "${BUILD_DIR}"
|
2020-02-14 10:28:19 +00:00
|
|
|
DOCKER_HASH=$(head -c 16 < /dev/urandom | xxd -p)
|
2017-04-10 14:24:53 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
QLOUD_ENDPOINT="https://platform.yandex-team.ru/api/v1"
|
|
|
|
QLOUD_PROJECT="clickhouse.clickhouse-website"
|
|
|
|
if [[ -z "$1" ]]
|
|
|
|
then
|
|
|
|
QLOUD_ENV="${QLOUD_PROJECT}.test"
|
|
|
|
else
|
|
|
|
QLOUD_ENV="${QLOUD_PROJECT}.prod"
|
|
|
|
fi
|
2017-05-30 14:21:04 +00:00
|
|
|
echo ">>> Successfully deployed ${TAG} ${DOCKER_HASH} to ${QLOUD_ENV} <<<"
|