commit | author | age
|
478402
|
1 |
on: |
JK |
2 |
schedule: |
|
3 |
- cron: '41 8 * * *' |
56212d
|
4 |
workflow_dispatch: |
478402
|
5 |
|
JK |
6 |
name: Update dependencies |
|
7 |
|
|
8 |
jobs: |
|
9 |
update: |
|
10 |
name: Update dependencies |
|
11 |
runs-on: ubuntu-latest |
|
12 |
steps: |
|
13 |
- id: checkout |
|
14 |
name: Checkout code |
de93e7
|
15 |
uses: actions/checkout@v3 |
478402
|
16 |
|
JK |
17 |
- id: java |
|
18 |
name: Install Java and Maven |
de93e7
|
19 |
uses: actions/setup-java@v2 |
478402
|
20 |
with: |
de93e7
|
21 |
distribution: zulu |
JK |
22 |
java-version: 11 |
478402
|
23 |
|
JK |
24 |
- id: update_keycloak |
|
25 |
name: Update Keycloak |
|
26 |
run: | |
|
27 |
mvn -B versions:update-property -Dproperty=keycloak.version |
|
28 |
|
|
29 |
- id: vars |
|
30 |
name: Get project variables |
|
31 |
run: | |
|
32 |
echo -n "::set-output name=versionUpdated::" |
|
33 |
[ -f pom.xml.versionsBackup ] && echo 1 || echo 0 |
|
34 |
echo -n "::set-output name=keycloakVersion::" |
|
35 |
mvn -q help:evaluate -Dexpression=keycloak.version -DforceStdout 2> /dev/null | grep -E '^[0-9a-zA-Z.-]+$' |
|
36 |
|
|
37 |
- id: check_branch |
|
38 |
name: Check if branch exists |
|
39 |
run: | |
|
40 |
echo -n "::set-output name=commit::" |
|
41 |
if [ '${{ steps.vars.outputs.versionUpdated }}' == '1' ]; then |
|
42 |
git ls-remote origin 'feature/keycloak-update-${{ steps.vars.outputs.keycloakVersion }}' |
|
43 |
else |
|
44 |
git rev-parse HEAD |
|
45 |
fi |
|
46 |
|
|
47 |
- id: reset_repo |
|
48 |
name: Reset repository |
|
49 |
if: steps.check_branch.outputs.commit == '' |
|
50 |
run: | |
|
51 |
git reset --hard |
|
52 |
|
|
53 |
- id: update_deps |
|
54 |
name: Update dependencies |
|
55 |
if: steps.check_branch.outputs.commit == '' |
|
56 |
run: | |
|
57 |
mvn versions:set -DnewVersion='${{ steps.vars.outputs.keycloakVersion }}' |
|
58 |
mvn versions:compare-dependencies \ |
|
59 |
-DremotePom='org.keycloak:keycloak-parent:${{ steps.vars.outputs.keycloakVersion }}' \ |
|
60 |
-DupdateDependencies=true -DupdatePropertyVersions=true |
|
61 |
mvn versions:use-latest-versions -DallowMajorUpdates=false |
|
62 |
|
|
63 |
- id: create_commit |
|
64 |
name: Create commit |
|
65 |
if: steps.check_branch.outputs.commit == '' |
|
66 |
run: | |
|
67 |
git add pom.xml |
|
68 |
git config user.name 'github-actions' |
|
69 |
git config user.email '41898282+github-actions[bot]@users.noreply.github.com' |
|
70 |
git commit -m 'Update to Keycloak ${{ steps.vars.outputs.keycloakVersion }}' |
|
71 |
|
|
72 |
- id: create_branch |
|
73 |
name: Create branch |
|
74 |
if: steps.check_branch.outputs.commit == '' |
|
75 |
run: | |
|
76 |
git push origin 'HEAD:feature/keycloak-update-${{ steps.vars.outputs.keycloakVersion }}' |
|
77 |
|
|
78 |
- id: set_token |
|
79 |
name: Set access token |
|
80 |
if: steps.check_branch.outputs.commit == '' |
|
81 |
run: | |
|
82 |
if [ '${{ secrets.GH_TOKEN }}' != '' ]; then |
707bb4
|
83 |
echo 'GH_TOKEN=${{ secrets.GH_TOKEN }}' >> $GITHUB_ENV |
478402
|
84 |
else |
707bb4
|
85 |
echo 'GH_TOKEN=${{ secrets.GITHUB_TOKEN }}' >> $GITHUB_ENV |
478402
|
86 |
fi |
JK |
87 |
|
|
88 |
- id: create_pull_request_default_token |
|
89 |
name: Create pull request |
|
90 |
if: steps.check_branch.outputs.commit == '' |
de93e7
|
91 |
uses: actions/github-script@v6 |
478402
|
92 |
with: |
JK |
93 |
github-token: ${{ env.GH_TOKEN }} |
|
94 |
script: | |
|
95 |
github.pulls.create({ |
|
96 |
owner: context.repo.owner, |
|
97 |
repo: context.repo.repo, |
|
98 |
head: 'feature/keycloak-update-${{ steps.vars.outputs.keycloakVersion }}', |
|
99 |
base: 'master', |
|
100 |
title: 'Update to Keycloak ${{ steps.vars.outputs.keycloakVersion }}', |
|
101 |
body: 'Automatic dependency bump due to release of Keycloak ${{ steps.vars.outputs.keycloakVersion }}' |
|
102 |
}) |