-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (59 loc) · 2.86 KB
/
prepare-release-branch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Prepare release branch
on:
workflow_dispatch:
inputs:
version_part:
description: The part of the version to update (Patch, Minor or Major)
required: true
type: choice
options:
- Patch
- Minor
- Major
default: 'Minor'
jobs:
prepare-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: Validate inputs
run: |
echo "INPUT_VERSION_PART: ${{ github.event.inputs.version_part }}"
python -c "if '${{ github.event.inputs.version_part }}' not in ['Patch', 'Minor', 'Major']: raise ValueError(\"'${{ github.event.inputs.version_part }}' must be one of ['Patch', 'Minor', 'Major'])\")"
- name: Save current version
id: save_current_version
run: |
mvn versions:set -DremoveSnapshot -DgenerateBackupPoms=false
echo "::set-output name=current_version::$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)"
- name: Update the CHANGELOG according to 'Keep a Changelog' guidelines
uses: thomaseizinger/keep-a-changelog-new-release@v1
with:
version: ${{ steps.save_current_version.outputs.current_version }}
- name: Create a new release branch
run: |
git config user.name github-actions
git config user.email [email protected]
git commit -am "Bump CHANGELOG for release ${{ steps.save_current_version.outputs.current_version }}"
git checkout -b release/${{ steps.save_current_version.outputs.current_version }}
git push -u origin release/${{ steps.save_current_version.outputs.current_version }}
- name: Bump development version
run: |
git checkout -b bump-version-after-${{ steps.save_current_version.outputs.current_version }}
mvn validate -D 'bump${{ github.event.inputs.version_part }}' -DgenerateBackupPoms=false
git commit -am "Bump development version to $(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)"
git push -u origin bump-version-after-${{ steps.save_current_version.outputs.current_version }}
- name: Open a PR to bump development version to main
id: open_pr
uses: vsoch/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_BRANCH: main
PULL_REQUEST_FROM_BRANCH: bump-version-after-${{ steps.save_current_version.outputs.current_version }}
PULL_REQUEST_TITLE: "Bump development version after release of ${{ steps.save_current_version.outputs.current_version }}"
PULL_REQUEST_BODY: "Bump SNAPSHOT version and CHANGELOG for subsequent development."