From 40ee8e7fe2aed40926ac0153a9ba3e6c996d2339 Mon Sep 17 00:00:00 2001 From: Blargian Date: Fri, 10 Jan 2025 11:22:27 +0100 Subject: [PATCH] update changelog to reference previous year if there are no releases for the current year --- copyClickhouseRepoDocs.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/copyClickhouseRepoDocs.sh b/copyClickhouseRepoDocs.sh index 5624afb9e6b..643bd7a4942 100755 --- a/copyClickhouseRepoDocs.sh +++ b/copyClickhouseRepoDocs.sh @@ -6,7 +6,9 @@ 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 +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 @@ -34,12 +36,15 @@ if grep -q '^# $(date +%Y) Changelog' ClickHouse/CHANGELOG.md; then rm temp.txt echo "$(date +%Y) Changelog was updated." else - echo "No Changelog found for present year." + 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 -r ClickHouse +rm -rf ClickHouse echo "[$SCRIPT_NAME] Deleting ClickHouse repo completed" echo "[$SCRIPT_NAME] Finish tasks for copying docs from ClickHouse repo"