diff --git a/.github/workflows/run-patch-release.yml b/.github/workflows/run-patch-release.yml index e1bd0ca2b25..57347730410 100644 --- a/.github/workflows/run-patch-release.yml +++ b/.github/workflows/run-patch-release.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: inputs: version: - description: 'The current version to be released, normally the `FF version` (semver format: major.minor.patch)' + description: 'The current to-be-released version (semver format: major.minor.patch). E.g. If the feature freeze / release for 9.3.1 is coming, use 9.3.1.' required: true type: string @@ -44,7 +44,6 @@ jobs: env: RELEASE_BRANCH: ${{ needs.prepare.outputs.release-branch }} RELEASE_TYPE: ${{ needs.prepare.outputs.release-type }} - RELEASE_VERSION: ${{ needs.prepare.outputs.release-version }} steps: - name: Get token id: get_token @@ -59,10 +58,18 @@ jobs: with: # 0 indicates all history for all branches and tags. fetch-depth: 0 - # Use the makefile in the given release branch. - ref: ${{ env.RELEASE_BRANCH }} token: ${{ steps.get_token.outputs.token }} + - id: bump_version + shell: bash + run: | + VERSION="${{ needs.prepare.outputs.release-version }}" + MAJOR=$(echo "$VERSION" | cut -d. -f1) + MINOR=$(echo "$VERSION" | cut -d. -f2) + PATCH=$(echo "$VERSION" | cut -d. -f3) + NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" + echo "version=${NEW_VERSION}" >> "$GITHUB_OUTPUT" + # Required to use a service account, otherwise PRs created by # GitHub bot won't trigger any CI builds. # See https://github.com/peter-evans/create-pull-request/issues/48#issuecomment-537478081 @@ -82,6 +89,7 @@ jobs: - run: make patch-release env: GH_TOKEN: ${{ steps.get_token.outputs.token }} + BUMP_VERSION: ${{ steps.bump_version.outputs.version }} - if: success() uses: elastic/oblt-actions/slack/send@v1 @@ -89,8 +97,8 @@ jobs: bot-token: ${{ secrets.SLACK_BOT_TOKEN }} channel-id: ${{ env.SLACK_CHANNEL }} message: |- - Feature freeze for `${{ github.repository }}@${{ env.RELEASE_VERSION }}` is Today. - All the relevant PRs and issues have been created. + PRs to bump versions in `${{ github.repository }}@${{ env.RELEASE_BRANCH }}` branch to `${{ steps.bump_version.outputs.version }}` have been created. + Remember to create PRs for the changelogs separately! thread-timestamp: ${{ needs.prepare.outputs.slack-thread || '' }} - if: failure() diff --git a/release.mk b/release.mk index 7d2c5300f3f..afa4cb6a6af 100644 --- a/release.mk +++ b/release.mk @@ -44,8 +44,6 @@ ifneq ($(shell command -v gh 2>/dev/null),) CURRENT_RELEASE ?= $(shell gh release list --exclude-drafts --exclude-pre-releases --repo elastic/apm-server --limit 10 --json tagName --jq '.[].tagName|select(. | startswith("v$(PROJECT_MAJOR_VERSION)"))' | sed 's|v||g' | sort -r | head -n 1) RELEASE_BRANCH ?= $(PROJECT_MAJOR_VERSION).$(PROJECT_MINOR_VERSION) NEXT_PROJECT_MINOR_VERSION ?= $(PROJECT_MAJOR_VERSION).$(shell expr $(PROJECT_MINOR_VERSION) + 1).0 -NEXT_RELEASE ?= $(RELEASE_BRANCH).$(shell expr $(PROJECT_PATCH_VERSION) + 1) -BRANCH_PATCH = update-$(NEXT_RELEASE) endif # BASE_BRANCH select by release type (default patch) @@ -106,26 +104,16 @@ major-release: # This is the contract with the GitHub action .github/workflows/run-patch-release.yml # The GitHub action will provide the below environment variables: -# - RELEASE_VERSION +# - BUMP_VERSION # .PHONY: patch-release patch-release: @echo "INFO: Create feature branch and update the versions. Target branch $(RELEASE_BRANCH)" - $(MAKE) create-branch NAME=$(BRANCH_PATCH) BASE=$(RELEASE_BRANCH) - $(MAKE) update-version VERSION=$(RELEASE_VERSION) - $(MAKE) update-version-makefile VERSION=$(PROJECT_MAJOR_VERSION)\.$(PROJECT_MINOR_VERSION) - $(MAKE) update-version-legacy VERSION=$(NEXT_RELEASE) PREVIOUS_VERSION=$(CURRENT_RELEASE) - $(MAKE) create-commit COMMIT_MESSAGE="$(RELEASE_BRANCH): update versions to $(RELEASE_VERSION)" - @echo "INFO: Push changes to $(PROJECT_OWNER)/apm-server and create the relevant Pull Requests" - $(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 - - @echo "INFO: Create feature branch and update the versions. Target branch $(BASE_BRANCH)" - $(MAKE) create-branch NAME=update-$(RELEASE_VERSION) BASE=$(BASE_BRANCH) - $(MAKE) update-changelog VERSION=$(RELEASE_VERSION) - $(MAKE) create-commit COMMIT_MESSAGE="[Release] update changelogs for $(RELEASE_BRANCH) release" + $(MAKE) create-branch NAME="update-$(BUMP_VERSION)" BASE=$(RELEASE_BRANCH) + $(MAKE) update-version VERSION=$(BUMP_VERSION) + $(MAKE) create-commit COMMIT_MESSAGE="$(RELEASE_BRANCH): update versions to $(BUMP_VERSION)" @echo "INFO: Push changes to $(PROJECT_OWNER)/apm-server and create the relevant Pull Requests" - git push origin update-$(RELEASE_VERSION) - $(MAKE) create-pull-request BRANCH=update-$(RELEASE_VERSION) TARGET_BRANCH=$(BASE_BRANCH) TITLE="$(RELEASE_BRANCH): update release notes" BODY="Merge as soon as the GitHub checks are green." + $(MAKE) create-pull-request BRANCH="update-$(BUMP_VERSION)" TARGET_BRANCH=$(RELEASE_BRANCH) TITLE="$(BUMP_VERSION): update versions" BODY="Merge on request by the Release Manager." BACKPORT_LABEL=backport-skip ############################################ ## Internal make goals to bump versions