-
Notifications
You must be signed in to change notification settings - Fork 288
/
Copy pathcopyClickhouseRepoDocs.sh
executable file
·50 lines (41 loc) · 1.92 KB
/
copyClickhouseRepoDocs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! ./bin/bash
SCRIPT_NAME=$(basename "$0")
echo "[$SCRIPT_NAME] Start tasks for copying docs from ClickHouse repo"
# Clone ClickHouse repo
echo "[$SCRIPT_NAME] Start cloning ClickHouse repo"
git clone --depth 1 https://github.com/ClickHouse/ClickHouse.git temp
cp -r temp/ ClickHouse/
rm -rf temp
echo "[$SCRIPT_NAME] Cloning completed"
# Copy docs folders from ClickHouse repo to docs folder
echo "[$SCRIPT_NAME] Start copying docs"
cp -r ClickHouse/docs/en/development docs/en/
cp -r ClickHouse/docs/en/engines docs/en/
cp -r ClickHouse/docs/en/getting-started docs/en/
cp -r ClickHouse/docs/en/interfaces docs/en/
cp -r ClickHouse/docs/en/operations docs/en/
cp -r ClickHouse/docs/en/sql-reference docs/en/
cp -r ClickHouse/docs/ru docs/
cp -r ClickHouse/docs/zh docs/
# Necessary for autogenerating settings
cp ClickHouse/src/Core/FormatFactorySettings.h "$(dirname "$0")"
cp ClickHouse/src/Core/Settings.cpp "$(dirname "$0")"
echo "[$SCRIPT_NAME] Copying completed"
echo "[$SCRIPT_NAME] Generate changelog"
cp docs/en/_placeholders/changelog/_index.md docs/en/whats-new/changelog/index.md
if grep -q '^# $(date +%Y) Changelog' ClickHouse/CHANGELOG.md; then
sed '/^# $(date +%Y) Changelog/d' ClickHouse/CHANGELOG.md > temp.txt
cat >> docs/en/whats-new/changelog/index.md
rm temp.txt
echo "$(date +%Y) Changelog was updated."
else
current_year="$(date +%Y)"
previous_year="$(($current_year - 1))"
echo "No Changelog found for $current_year."
echo -e ":::note\nThere have been no new releases yet for $current_year. \n View changelog for the year [$previous_year](/docs/en/whats-new/changelog/$previous_year).\n:::" >> docs/en/whats-new/changelog/index.md
fi
# Delete ClickHouse repo
echo "[$SCRIPT_NAME] Start deleting ClickHouse repo"
rm -rf ClickHouse
echo "[$SCRIPT_NAME] Deleting ClickHouse repo completed"
echo "[$SCRIPT_NAME] Finish tasks for copying docs from ClickHouse repo"