Refactor the release build process so that all links are updated.
Previously, links in release notes would get stomped by the followup
cherrypick from master.
@@ -180,6 +180,11 @@ ifneq ($(VERSION),)
MINOR=$(shell echo $(VERSION) | cut -f2 -d'.')
PATCH=$(shell echo $(VERSION) | cut -f3 -d'.')
endif
+ifeq ($(PATCH),0)
+ PREV_VERSION=master
+else
+ PREV_VERSION=v$(MAJOR).$(MINOR).$(shell expr $(PATCH) - 1)
+endif
release:
ifeq ($(VERSION),)
@@ -196,13 +201,15 @@ endif
endif
ifeq ($(PATCH),0)
git checkout -b v$(MAJOR).$(MINOR)
- perl -pi -e 's#/google/metallb/master#/google/metallb/v$(VERSION)#g' website/content/*.md website/content/*/*.md
- perl -pi -e 's#/google/metallb/tree/master#/google/metallb/tree/v$(VERSION)#g' website/content/*.md website/content/*/*.md
else
git checkout v$(MAJOR).$(MINOR)
- perl -pi -e "s#/google/metallb/v$(MAJOR).$(MINOR).$$(($(PATCH)-1))#/google/metallb/v$(VERSION)#g" website/content/*.md website/content/*/*.md
- perl -pi -e "s#/google/metallb/tree/v$(MAJOR).$(MINOR).$$(($(PATCH)-1))#/google/metallb/tree/v$(VERSION)#g" website/content/*.md website/content/*/*.md
endif
+ git checkout master -- website/content/release-notes/_index.md
+
+ perl -pi -e "s#/google/metallb/$(PREV_VERSION)#/google/metallb/v$(VERSION)#g" website/content/*.md website/content/*/*.md
+ perl -pi -e "s#/google/metallb/tree/$(PREV_VERSION)#/google/metallb/tree/v$(VERSION)#g" website/content/*.md website/content/*/*.md
+ perl -pi -e "s#/google/metallb/blob/$(PREV_VERSION)#/google/metallb/tree/v$(VERSION)#g" website/content/*.md website/content/*/*.md
+
perl -pi -e 's#image: metallb/(.*):.*#image: metallb/$$1:v$(VERSION)#g' manifests/*.yaml
perl -pi -e 's/appVersion: .*/appVersion: $(VERSION)/g' helm/metallb/Chart.yaml
@@ -210,7 +217,6 @@ endif
perl -pi -e 's/pullPolicy: .*/pullPolicy: IfNotPresent/g' helm/metallb/values.yaml
+make manifest
- git checkout master -- website/content/release-notes/_index.md
perl -pi -e 's/MetalLB .*/MetalLB v$(VERSION)/g' website/content/_header.md
perl -pi -e 's/version\s+=.*/version = "$(VERSION)"/g' internal/version/version.go
gofmt -w internal/version/version.go
