From ec42b64a30a9f6b96fdc9995be1f871b0845ba76 Mon Sep 17 00:00:00 2001 From: Cecile Robert-Michon Date: Thu, 28 Oct 2021 16:16:19 -0700 Subject: [PATCH] Handle pre-releases in release-notes make target --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 498c87a03fd..cfb6bf7ecf7 100644 --- a/Makefile +++ b/Makefile @@ -419,6 +419,10 @@ set-manifest-pull-policy: ## -------------------------------------- RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null) +# if the release tag contains a hyphen, treat it as a pre-release +ifneq (,$(findstring -,$(RELEASE_TAG))) + PRE_RELEASE=true +endif # the previous release tag, e.g., v0.3.9, excluding pre-release tags PREVIOUS_TAG ?= $(shell git tag -l | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$$" | sort -V | grep -B1 $(RELEASE_TAG) | head -n 1 2>/dev/null) RELEASE_DIR ?= out @@ -484,9 +488,11 @@ release-alias-tag: # Adds the tag to the last build tag. .PHONY: release-notes release-notes: $(RELEASE_NOTES) $(RELEASE_NOTES_DIR) - $(RELEASE_NOTES) --org $(GIT_ORG_NAME) --repo $(GIT_REPO_NAME) --branch $(RELEASE_BRANCH) --start-rev $(PREVIOUS_TAG) --end-rev $(RELEASE_TAG) --output $(RELEASE_NOTES_DIR)/tmp-release-notes.md - sed 's/\[SIG Cluster Lifecycle\]//g' $(RELEASE_NOTES_DIR)/tmp-release-notes.md > $(RELEASE_NOTES_DIR)/release-notes-$(RELEASE_TAG).md - rm -f $(RELEASE_NOTES_DIR)/tmp-release-notes.md + @if [ -n "${PRE_RELEASE}" ]; then echo ":rotating_light: This is a RELEASE CANDIDATE. Use it only for testing purposes. If you find any bugs, file an [issue](https://github.com/kubernetes-sigs/cluster-api-provider-azure/issues/new)." > $(RELEASE_NOTES_DIR)/release-notes-$(RELEASE_TAG).md; \ + else $(RELEASE_NOTES) --org $(GIT_ORG_NAME) --repo $(GIT_REPO_NAME) --branch $(RELEASE_BRANCH) --start-rev $(PREVIOUS_TAG) --end-rev $(RELEASE_TAG) --output $(RELEASE_NOTES_DIR)/tmp-release-notes.md; \ + sed 's/\[SIG Cluster Lifecycle\]//g' $(RELEASE_NOTES_DIR)/tmp-release-notes.md > $(RELEASE_NOTES_DIR)/release-notes-$(RELEASE_TAG).md; \ + rm -f $(RELEASE_NOTES_DIR)/tmp-release-notes.md; \ + fi ## -------------------------------------- ## Development