Version and Release Notes #267
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: Version and Release Notes | |
on: create | |
jobs: | |
set-version: | |
if: ${{ (github.event.ref_type == 'branch') && startsWith(github.event.ref, 'release-') }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: temurin | |
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | |
settings-path: ${{ github.workspace }} # location for the settings.xml file | |
- id: what-version | |
name: Determine version | |
run: | | |
set -x | |
export VERSION="`echo ${{ github.event.ref }} | sed -e s/release-//g`" | |
echo "::set-output name=version::$VERSION" | |
- name: Set version and update readme | |
run: | | |
set -x | |
export VERSION="${{ steps.what-version.outputs.version }}" | |
mvn versions:set -DnewVersion=$VERSION --file pom.xml -DartifactId=superfields | |
mvn versions:set -DnewVersion=$VERSION --file pom.xml | |
sed -i -e s/{VERSION}/$VERSION/g ./README.md | |
- name: Push changes | |
uses: stefanzweifel/git-auto-commit-action@v4.1.6 | |
with: | |
commit_message: "(bot) version updated to ${{ steps.what-version.outputs.version }}" | |
branch: ${{ github.event.ref }} | |
- name: Resolve conflicts (keep ours) | |
run: | | |
set -x | |
git fetch | |
git checkout master | |
git checkout ${{ github.event.ref }} | |
git config user.email "${{ secrets.EMAIL }}" | |
git config user.name "Miki (bot)" | |
git merge master --strategy=ours | |
git push origin | |
- name: Create PR | |
uses: UnforgivenPL/pull-request@v1 | |
with: | |
source: ${{ github.event.ref }} | |
target: master | |
repository: ${{ github.repository }} | |
token: ${{ secrets.ACTIONS_PAT }} | |
pr-title: Release ${{ steps.what-version.outputs.version }} ready | |
pr-body: Automatically created release ${{ steps.what-version.outputs.version }}. | |
pr-assignees: ${{ github.actor }} |