Prepare release branch #9
This file contains hidden or 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: Prepare release branch | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_part: | |
| description: The part of the version to work on after the release (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 main | |
| 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 origin main |