Skip to content

Create release branch 0.0.0 #25

Create release branch 0.0.0

Create release branch 0.0.0 #25

name: Create release branch
run-name: Create release branch ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Full semantic version number of the next minor release, e.g. 8.4.0'
required: true
jobs:
create-release-branch:
name: Create release branch ${{ inputs.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
fetch-depth: 0
- name: Restore cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Prepare Java and Maven settings
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Configure git user
run: |
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Set snapshot version on release branch
id: set-snapshot-version
run: |
MINOR_VERSION=${RELEASE_VERSION%.*}
git checkout -b release/${MINOR_VERSION}
mvn -B versions:set -DnewVersion=${RELEASE_VERSION}-SNAPSHOT -DgenerateBackupPoms=false -f parent
git commit -am "ci: set next snapshot version"
git push origin release/${MINOR_VERSION}
git checkout -b temp:release/${RELEASE_VERSION%.*}
echo "branchName=temp:release/${RELEASE_VERSION%.*}" >> $GITHUB_OUTPUT
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}
- name: Create pull request to main branch
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.set-snapshot-version.outputs.branchName }}
commit-message: "ci: set next snapshot version"
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
base: main
title: "ci: set next snapshot version"
body: |
This PR sets the next snapshot version on the main branch.
Checklist:
- [ ] the PR should be accepted via the "Rebase and merge" option
- [ ] the branch must **not** be deleted after merging
- [ ] the PR contains exactly one commit with the version change
If this PR has conflicts, re-run the `Create release branch` workflow. No need to close the PR or delete the branch.
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}