From ed0b96de49da824d76122cbaf7fc15060405afe5 Mon Sep 17 00:00:00 2001 From: Zachary Hu <6426329+outsinre@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:42:12 +0800 Subject: [PATCH] chore(release): simplify changelog automation (#12762) FTI-5842 --- changelog/Makefile | 62 ++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 41 deletions(-) diff --git a/changelog/Makefile b/changelog/Makefile index d7cd67bdace3..68a9b9e9132a 100644 --- a/changelog/Makefile +++ b/changelog/Makefile @@ -40,7 +40,7 @@ check_version: fi create_branch: - @git fetch + @git fetch --prune @git submodule update --init --recursive @git checkout -B $(BRANCH_NAME) $(ORIGIN_BRANCH) @@ -48,47 +48,27 @@ generate: @rm -f $(VERSION).md @touch $(VERSION).md - @if [ -d "$(UNRELEASED_DIR)/kong" ] && [ -n "$$(shopt -s nullglob; echo $(UNRELEASED_DIR)/kong/*.yml)" ] ; then \ - if [ -f "$(VERSION)/$(VERSION).md" ]; then \ - changelog --debug=$(DEBUG) generate \ - --repo-path . \ - --changelog-paths $(VERSION)/kong,$(UNRELEASED_DIR)/kong \ - --title Kong \ - --github-issue-repo $(OWNER_REPO) \ - --github-api-repo $(OWNER_REPO) \ - --with-jiras \ - >> $(VERSION).md; \ - else \ - changelog --debug=$(DEBUG) generate \ - --repo-path . \ - --changelog-paths $(UNRELEASED_DIR)/kong \ - --title Kong \ - --github-issue-repo $(OWNER_REPO) \ - --github-api-repo $(OWNER_REPO) \ - --with-jiras \ - >> $(VERSION).md; \ - fi \ + @if [ -n "$$(shopt -s nullglob; echo $(UNRELEASED_DIR)/kong/*.yml)" ] || \ + [ -n "$$(shopt -s nullglob; echo $(VERSION)/kong/*.yml)" ] ; then \ + changelog --debug=$(DEBUG) generate \ + --repo-path . \ + --changelog-paths $(VERSION)/kong,$(UNRELEASED_DIR)/kong \ + --title Kong \ + --github-issue-repo $(OWNER_REPO) \ + --github-api-repo $(OWNER_REPO) \ + --with-jiras \ + >> $(VERSION).md; \ fi - @if [ -d "$(UNRELEASED_DIR)/kong-manager" ] && [ -n "$$(shopt -s nullglob; echo $(UNRELEASED_DIR)/kong-manager/*.yml)" ] ; then \ - if [ -f "$(VERSION)/$(VERSION).md" ]; then \ - changelog --debug=$(DEBUG) generate \ - --repo-path . \ - --changelog-paths $(VERSION)/kong-manager,$(UNRELEASED_DIR)/kong-manager \ - --title Kong-Manager \ - --github-issue-repo Kong/kong-manager \ - --github-api-repo $(OWNER_REPO) \ - --with-jiras \ - >> $(VERSION).md; \ - else \ - changelog --debug=$(DEBUG) generate \ - --repo-path . \ - --changelog-paths $(UNRELEASED_DIR)/kong-manager \ - --title Kong-Manager \ - --github-issue-repo Kong/kong-manager \ - --github-api-repo $(OWNER_REPO) \ - --with-jiras \ - >> $(VERSION).md; \ - fi \ + @if [ -n "$$(shopt -s nullglob; echo $(UNRELEASED_DIR)/kong-manager/*.yml)" ] || \ + [ -n "$$(shopt -s nullglob; echo $(VERSION)/kong-manager/*.yml)" ] ; then \ + changelog --debug=$(DEBUG) generate \ + --repo-path . \ + --changelog-paths $(VERSION)/kong-manager,$(UNRELEASED_DIR)/kong-manager \ + --title Kong-Manager \ + --github-issue-repo Kong/kong-manager \ + --github-api-repo $(OWNER_REPO) \ + --with-jiras \ + >> $(VERSION).md; \ fi @echo