@@ -610,13 +610,16 @@ e2e: $(GINKGO) $(KUSTOMIZE) $(KIND) $(GOVC) ## Run e2e tests
610
610
611
611
# # latest git tag for the commit, e.g., v0.3.10
612
612
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.
613
614
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)"
617
622
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)
620
623
# # set by Prow, ref name of the base branch, e.g., main
621
624
RELEASE_ALIAS_TAG := $(PULL_BASE_REF )
622
625
RELEASE_DIR := out
@@ -727,7 +730,7 @@ release-alias-tag: ## Add the release alias tag to the last build tag
727
730
generate-release-notes : $(RELEASE_NOTES_DIR ) $(RELEASE_NOTES )
728
731
# Reset the file
729
732
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
731
734
732
735
.PHONY : promote-images
733
736
promote-images : $(KPROMO )
0 commit comments