Skip to content

Commit 7487d02

Browse files
authored
Merge pull request #2873 from chrischdi/pr-fix-release-notes-generator
🌱 Makefile: fix release-notes generator arguments
2 parents 47f8878 + aad81b6 commit 7487d02

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Makefile

+9-6
Original file line numberDiff line numberDiff line change
@@ -610,13 +610,16 @@ e2e: $(GINKGO) $(KUSTOMIZE) $(KIND) $(GOVC) ## Run e2e tests
610610

611611
## latest git tag for the commit, e.g., v0.3.10
612612
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
613+
## if we are on a pre-release, we have to determine the previous release for the release-notes generator.
613614
ifneq (,$(findstring -,$(RELEASE_TAG)))
614-
PRE_RELEASE=true
615-
else
616-
PRE_RELEASE=false
615+
# extract the major and minor version from the RELEASE_TAG
616+
_RELEASE_TAG_MAJOR ?= $(word 1,$(subst ., ,$(RELEASE_TAG:v%=%)))
617+
_RELEASE_TAG_MINOR ?= $(word 2,$(subst ., ,$(RELEASE_TAG:v%=%)))
618+
# Find the previous release of the same major + minor version (including pre-releases) or the previous .0 minor release.
619+
_PREVIOUS_RELEASE_TAG ?= $(shell git tag -l | grep -E -e '^v[0-9]+\.[0-9]+\.0+$$|^v$(_RELEASE_TAG_MAJOR)\.$(_RELEASE_TAG_MINOR)\.' | sort -V | grep -B1 $(RELEASE_TAG) | head -n 1 2>/dev/null)
620+
# Set the argument for release-notes generator to provide the for pre-releases mandatory `--previous-release-version` flag.
621+
RELEASE_NOTES_PRE_RELEASE_ARG ?= "--previous-release-version=tags/$(_PREVIOUS_RELEASE_TAG)"
617622
endif
618-
# the previous release tag, e.g., v0.3.9, excluding pre-release tags
619-
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)
620623
## set by Prow, ref name of the base branch, e.g., main
621624
RELEASE_ALIAS_TAG := $(PULL_BASE_REF)
622625
RELEASE_DIR := out
@@ -727,7 +730,7 @@ release-alias-tag: ## Add the release alias tag to the last build tag
727730
generate-release-notes: $(RELEASE_NOTES_DIR) $(RELEASE_NOTES)
728731
# Reset the file
729732
echo -n > $(RELEASE_NOTES_DIR)/$(RELEASE_TAG).md
730-
"$(RELEASE_NOTES)" --release=$(RELEASE_TAG) --repository kubernetes-sigs/cluster-api-provider-vsphere --prefix-area-label=false --deprecation=false --add-kubernetes-version-support=false --pre-release-version=$(PRE_RELEASE) >> $(RELEASE_NOTES_DIR)/$(RELEASE_TAG).md
733+
"$(RELEASE_NOTES)" --release=$(RELEASE_TAG) $(RELEASE_NOTES_PRE_RELEASE_ARG) --repository kubernetes-sigs/cluster-api-provider-vsphere --prefix-area-label=false --deprecation=false --add-kubernetes-version-support=false >> $(RELEASE_NOTES_DIR)/$(RELEASE_TAG).md
731734

732735
.PHONY: promote-images
733736
promote-images: $(KPROMO)

0 commit comments

Comments
 (0)