forked from daniel-frak/keycloak-user-migration
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (64 loc) · 2.45 KB
/
release.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
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@v4
with:
distribution: adopt
java-version: 21
- 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 }}