3.0.0 #17
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: Release new version | |
on: | |
release: | |
types: [created] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set Up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Setup Git user | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Set POM version to ${{ github.ref_name }} | |
run: mvn versions:set -DnewVersion=${GITHUB_REF##*/} | |
- name: Commit changes before releasing (optionally) | |
# Don't fail if nothing to commit | |
run: | | |
git add pom.xml ./\*.java ./\*.md | |
set +e | |
git commit -m "build: Set version to $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" | |
set -e | |
- name: Push changes before releasing | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build jar | |
run: mvn clean package | |
- name: Create Release | |
uses: jasonetco/[email protected] | |
with: | |
args: target/keycloak-rest-provider-${{ github.ref_name }}.jar application/java-archive | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Increment version after releasing | |
run: mvn versions:set -DnextSnapshot | |
- name: Commit changes after releasing (version increment) | |
run: | | |
git add pom.xml | |
git commit -m "build: Increment version to $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" | |
- name: Update latest version in README.md to ${{ github.ref_name }} | |
uses: mingjun97/file-regex-replace@v1 | |
with: | |
regex: '(?<=\| )SNAPSHOT(?= )' | |
replacement: '[${{ github.ref_name }}](https://github.com/daniel-frak/keycloak-user-migration/releases/tag/${{ github.ref_name }})' | |
- name: Commit changes after publishing (documentation update, optionally) | |
# Don't fail if nothing to commit | |
run: | | |
git add README.md | |
set +e | |
git commit -m "docs: Update latest version in README.md to ${{ github.ref_name }}" | |
set -e | |
- name: Push changes after publishing (documentation update) | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |