Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/run-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -44,16 +44,13 @@ jobs:
env:
RELEASE_BRANCH: ${{ needs.prepare.outputs.release-branch }}
RELEASE_TYPE: ${{ needs.prepare.outputs.release-type }}
RELEASE_VERSION: ${{ needs.prepare.outputs.release-version }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
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 }}

- name: Get token
id: get_token
Expand All @@ -80,18 +77,29 @@ jobs:
git_user_signingkey: true
git_commit_gpgsign: true

- 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"

- 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
with:
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()
Expand Down
14 changes: 5 additions & 9 deletions release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

# for the view commits
Expand Down Expand Up @@ -188,18 +186,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)"
$(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"
$(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
$(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
Expand Down
Loading