Skip to content

Fix patch release workflow version (#20843) #195

Fix patch release workflow version (#20843)

Fix patch release workflow version (#20843) #195

---
name: run-patch-release
on:
workflow_dispatch:
inputs:
version:
<<<<<<< HEAD

Check failure on line 8 in .github/workflows/run-patch-release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/run-patch-release.yml

Invalid workflow file

You have an error in your yaml syntax on line 8
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.'
>>>>>>> 2b87820c (Fix patch release workflow version (#20843))
required: true
type: string
# Avoid concurrency so we can watch the releases correctly
concurrency:
group: ${{ github.workflow }}
permissions:
contents: read
env:
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_CHANNEL: "#apm-server"
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
release-branch: ${{ steps.prepare.outputs.release-branch }}
release-type: ${{ steps.prepare.outputs.release-type }}
release-version: ${{ steps.prepare.outputs.release-version }}
slack-thread: ${{ steps.prepare.outputs.slack-thread }}
steps:
- uses: actions/checkout@v6
- id: prepare
uses: ./.github/workflows/prepare-release
with:
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
version: ${{ inputs.version }}
type: 'patch'
run-patch:
runs-on: ubuntu-latest
needs: [ prepare ]
env:
RELEASE_BRANCH: ${{ needs.prepare.outputs.release-branch }}
RELEASE_TYPE: ${{ needs.prepare.outputs.release-type }}
steps:
- name: Get token
id: get_token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
private-key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
permission-contents: write
permission-pull-requests: write
- uses: actions/checkout@v6
with:
# 0 indicates all history for all branches and tags.
fetch-depth: 0
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
- name: Configure git user
uses: elastic/oblt-actions/git/setup@v1
with:
github-token: ${{ steps.get_token.outputs.token }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- 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: |-
<<<<<<< HEAD
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!
>>>>>>> 2b87820c (Fix patch release workflow version (#20843))
thread-timestamp: ${{ needs.prepare.outputs.slack-thread || '' }}
- if: failure()
uses: elastic/oblt-actions/slack/send@v1
with:
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: ${{ env.SLACK_CHANNEL }}
message: |-
:fire: Something went wrong with the patch release. See <${{ env.JOB_URL }}|logs>.
thread-timestamp: ${{ needs.prepare.outputs.slack-thread || '' }}