[release] improve release steps naming #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | ||
name: Pre/Post Release | ||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: 'Branch or tag ref to run the workflow on' | ||
type: string | ||
required: true | ||
default: 'main' | ||
version: | ||
description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps' | ||
type: string | ||
required: true | ||
phase: | ||
description: 'Pre or post release phase' | ||
type: string # valid values are 'pre' or 'post' | ||
required: true | ||
pr_title: | ||
description: 'pull-request title' | ||
type: string | ||
required: true | ||
pr_body: | ||
description: : 'pull-request body' | ||
type: string | ||
required: true | ||
env: | ||
RELEASE_VERSION: ${{ inputs.version }} | ||
BRANCH_NAME: ${{ inputs.phase }}-release-v${{ inputs.version }} | ||
permissions: | ||
contents: read | ||
jobs: | ||
validate-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Validate tag does not exist on current commit | ||
uses: ./.github/workflows/validate-tag | ||
with: | ||
tag: v${{ env.RELEASE_VERSION }} | ||
create-pr: | ||
name: "Bump versions and create PR" | ||
runs-on: ubuntu-latest | ||
needs: | ||
- validate-tag | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: elastic/apm-pipeline-library/.github/actions/github-token@current | ||
with: | ||
url: ${{ secrets.VAULT_ADDR }} | ||
roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
- uses: elastic/apm-pipeline-library/.github/actions/setup-git@current | ||
with: | ||
username: ${{ env.GIT_USER }} | ||
email: ${{ env.GIT_EMAIL }} | ||
token: ${{ env.GITHUB_TOKEN }} | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
token: ${{ env.GITHUB_TOKEN }} | ||
- name: Create the release tag (post phase) | ||
if: inputs.phase == 'post' | ||
run: | | ||
git tag "v${{ env.RELEASE_VERSION }}" | ||
git push origin "v${{ env.RELEASE_VERSION }}" | ||
- name: Create a ${{ inputs.phase }} release branch | ||
run: git checkout -b ${{ env.BRANCH_NAME }} | ||
- name: Set release version (pre release) | ||
if: inputs.phase == 'pre' | ||
uses: ./.github/workflows/maven-goal | ||
with: | ||
command: ./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnewVersion=${{ env.RELEASE_VERSION }} | ||
- name: Set next snapshot version (post release) | ||
if: inputs.phase == 'post' | ||
uses: ./.github/workflows/maven-goal | ||
with: | ||
command: ./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnextSnapshot=true | ||
- name: Push the ${{ inputs.phase }} release branch | ||
run: | | ||
git add --all | ||
git commit -m "${{ inputs.phase }} release: ecs-logging-java v${{ env.RELEASE_VERSION }}" | ||
git push origin ${{ env.BRANCH_NAME }} | ||
- name: Create the ${{ inputs.phase }} release PR | ||
run: gh pr create --title="${{ inputs.pr_title }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.pr_body }}" |