Skip to content

Commit f016ab4

Browse files
committed
release: support 8.x releases
1 parent 370809b commit f016ab4

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

release.mk

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ NEXT_RELEASE ?= $(RELEASE_BRANCH).$(shell expr $(PROJECT_PATCH_VERSION) + 1)
4747
BRANCH_PATCH = update-$(NEXT_RELEASE)
4848

4949
# for the view commits
50-
# as long as 8.x is the branch to run releases, then the base branch is 8.x
51-
# when 8.x is not available the we should use main as the base branch.
50+
# NOTE: as long as 8.x is the branch to run releases, then we use base branch 8.x
51+
# when 8.x is not available then we use the main base branch.
5252
CHANGELOG_BRANCH = 8.x
5353

5454
# BASE_BRANCH select by release type (default patch)
5555
ifeq ($(RELEASE_TYPE),minor)
56-
# as long as 8.x is the branch to run releases, then the base branch is 8.x
57-
# when 8.x is not available the we should use main as the base branch.
56+
# NOTE: as long as 8.x is the branch to run releases, then we use base branch 8.x
57+
# when 8.x is not available then we use the main base branch.
5858
BASE_BRANCH ?= 8.x
5959
endif
6060

@@ -117,23 +117,38 @@ minor-release:
117117
$(MAKE) create-commit COMMIT_MESSAGE="[Release] update version $(RELEASE_VERSION)"
118118

119119
@echo "INFO: Create feature branch and update the versions. Target branch $(RELEASE_BRANCH)"
120-
$(MAKE) create-branch NAME=changelog-$(RELEASE_BRANCH) BASE=$(RELEASE_BRANCH)
120+
# NOTE: as long as 8.x is the branch to run releases, then the base branch is 8.x
121+
# when 8.x is not available the we should use main as the base branch.
122+
# BASE=$(RELEASE_BRANCH)
123+
# Target main and use the backport strategy
124+
$(MAKE) create-branch NAME=changelog-$(RELEASE_BRANCH) BASE=main
121125
$(MAKE) update-changelog VERSION=$(RELEASE_BRANCH)
122126
$(MAKE) rename-changelog VERSION=$(RELEASE_BRANCH)
127+
# NOTE: as long as 8.x is the branch to run releases, then we update mergify
128+
# when 8.x is not available then this conditional and the update-mergify should be removed..
129+
ifeq ($(BASE_BRANCH),8.x)
130+
$(MAKE) update-mergify VERSION=$(RELEASE_BRANCH)
131+
endif
123132
$(MAKE) create-commit COMMIT_MESSAGE="docs: Update changelogs for $(RELEASE_BRANCH) release"
124133

125134
@echo "INFO: Create feature branch and update the versions. Target branch $(BASE_BRANCH)"
126135
$(MAKE) create-branch NAME=update-$(RELEASE_VERSION) BASE=$(BASE_BRANCH)
136+
# NOTE: as long as main is the branch to run releases, then we update mergify
137+
# when 8.x is not available then this conditional should be removed and the update-mergify should be kept.
138+
ifeq ($(BASE_BRANCH),main)
127139
$(MAKE) update-mergify VERSION=$(RELEASE_BRANCH)
140+
endif
128141
$(MAKE) update-version VERSION=$(NEXT_PROJECT_MINOR_VERSION)
129142
$(MAKE) create-commit COMMIT_MESSAGE="[Release] update version $(NEXT_PROJECT_MINOR_VERSION)"
130143
$(MAKE) rename-changelog VERSION=$(RELEASE_BRANCH)
131144
$(MAKE) create-commit COMMIT_MESSAGE="[Release] update changelogs for $(RELEASE_BRANCH) release"
132145

133146
@echo "INFO: Push changes to $(PROJECT_OWNER)/apm-server and create the relevant Pull Requests"
134147
git push origin $(RELEASE_BRANCH)
135-
$(MAKE) create-pull-request BRANCH=update-$(RELEASE_VERSION) TARGET_BRANCH=$(BASE_BRANCH) TITLE="$(RELEASE_BRANCH): update docs, mergify, versions and changelogs" BODY="Merge as soon as the GitHub checks are green."
136-
$(MAKE) create-pull-request BRANCH=changelog-$(RELEASE_BRANCH) TARGET_BRANCH=$(RELEASE_BRANCH) TITLE="$(RELEASE_BRANCH): update docs" BODY="Merge as soon as $(TARGET_BRANCH) branch is created and the GitHub checks are green."
148+
$(MAKE) create-pull-request BRANCH=update-$(RELEASE_VERSION) TARGET_BRANCH=$(BASE_BRANCH) TITLE="$(RELEASE_BRANCH): update docs, mergify, versions and changelogs" BODY="Merge as soon as the GitHub checks are green." BACKPORT_LABEL=backport-skip
149+
# NOTE: as long as 8.x is the branch to run releases, then we use main as target with the backport label.
150+
# when 8.x is not available then we use TARGET_BRANCH=$(RELEASE_BRANCH)
151+
$(MAKE) create-pull-request BRANCH=changelog-$(RELEASE_BRANCH) TARGET_BRANCH=main TITLE="$(RELEASE_BRANCH): update docs" BODY="Merge as soon as $(TARGET_BRANCH) branch is created and the GitHub checks are green." BACKPORT_LABEL=backport-$(RELEASE_BRANCH)
137152

138153
# This is the contract with the GitHub action .github/workflows/run-patch-release.yml
139154
# The GitHub action will provide the below environment variables:
@@ -148,7 +163,7 @@ patch-release:
148163
$(MAKE) update-version-legacy VERSION=$(NEXT_RELEASE) PREVIOUS_VERSION=$(CURRENT_RELEASE)
149164
$(MAKE) create-commit COMMIT_MESSAGE="$(RELEASE_BRANCH): update versions to $(RELEASE_VERSION)"
150165
@echo "INFO: Push changes to $(PROJECT_OWNER)/apm-server and create the relevant Pull Requests"
151-
$(MAKE) create-pull-request BRANCH=$(BRANCH_PATCH) TARGET_BRANCH=$(RELEASE_BRANCH) TITLE="$(RELEASE_VERSION): update versions" BODY="Merge on request by the Release Manager."
166+
$(MAKE) create-pull-request BRANCH=$(BRANCH_PATCH) TARGET_BRANCH=$(RELEASE_BRANCH) TITLE="$(RELEASE_VERSION): update versions" BODY="Merge on request by the Release Manager." BACKPORT_LABEL=backport-skip
152167

153168
############################################
154169
## Internal make goals to bump versions
@@ -270,7 +285,7 @@ create-commit:
270285

271286
## @help:create-pull-request:Create pull request
272287
.PHONY: create-pull-request
273-
create-pull-request: BRANCH=$${BRANCH} TITLE=$${TITLE} TARGET_BRANCH=$${TARGET_BRANCH} BODY=$${BODY}
288+
create-pull-request: BRANCH=$${BRANCH} TITLE=$${TITLE} TARGET_BRANCH=$${TARGET_BRANCH} BODY=$${BODY} BACKPORT_LABEL=$${BACKPORT_LABEL}
274289

275290
create-pull-request:
276291
@echo "::group::create-pull-request"
@@ -281,6 +296,7 @@ create-pull-request:
281296
--base $(TARGET_BRANCH) \
282297
--head $(BRANCH) \
283298
--label 'release' \
299+
--label "$(BACKPORT_LABEL)" \
284300
--reviewer "$(PROJECT_REVIEWERS)" \
285301
--repo $(PROJECT_OWNER)/apm-server || echo "There is no changes"
286302
@echo "::endgroup::"

0 commit comments

Comments
 (0)