-
Notifications
You must be signed in to change notification settings - Fork 74
100 lines (94 loc) · 3.51 KB
/
build-wars.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Build Wars
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'jans-keycloak-integration/**'
- 'jans-keycloak-link/**'
- 'agama/**'
- 'jans-auth-server/**'
- 'jans-lock/**'
- 'jans-bom/**'
- 'jans-config-api/**'
- 'jans-core/**'
- 'jans-fido2/**'
- 'jans-orm/**'
- 'jans-scim/**'
- 'jans-link/**'
push:
branches:
- main
paths:
- 'jans-keycloak-integration/**'
- 'jans-keycloak-link/**'
- 'agama/**'
- 'jans-auth-server/**'
- 'jans-lock/**'
- 'jans-bom/**'
- 'jans-config-api/**'
- 'jans-core/**'
- 'jans-fido2/**'
- 'jans-orm/**'
- 'jans-scim/**'
- 'jans-link/**'
jobs:
build:
if: github.repository == 'JanssenProject/jans'
name: Build wars
runs-on: ubuntu-latest
continue-on-error: true
strategy:
max-parallel: 11
matrix:
fldrpath: ['jans-bom','agama','jans-fido2','jans-core','jans-auth-server','jans-orm','jans-config-api','jans-scim','jans-keycloak-integration','jans-link','jans-keycloak-link','jans-lock']
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
with:
egress-policy: audit
- name : Variables
run: |
echo ${{ github.repository }}
echo ${{ github.actor }}
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: ${{ github.repository }}
- name: find changed directories
run: |
if [ $GITHUB_BASE_REF ]; then
# Pull Request
echo "Triggerring event: pull request"
echo Pull request base ref: $GITHUB_BASE_REF
git fetch origin $GITHUB_BASE_REF --depth=1
if [ ${{ github.event.action }} = "opened" ]; then
echo "Triggerring action: opened"
echo "DIRECTORIES_CHANGED=$( git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | cut -d/ -f1 | sort -u | sed -z 's/\n/,/g;s/^/[/;s/,$/]/;s/$/\n/')" >> ${GITHUB_ENV}
fi
if [ ${{ github.event.action }} = "synchronize" ]; then
echo "Triggerring action: synchronize"
echo "DIRECTORIES_CHANGED=$( git diff --name-only ${{ github.event.before }} ${{ github.event.pull_request.head.sha }} | cut -d/ -f1 | sort -u | sed -z 's/\n/,/g;s/^/[/;s/,$/]/;s/$/\n/')" >> ${GITHUB_ENV}
fi
else
# Push
echo "Triggerring event: push"
git fetch origin ${{ github.event.before }} --depth=1
echo "DIRECTORIES_CHANGED=$( git diff --name-only ${{ github.event.before }} ${{ github.sha }} | cut -d/ -f1 | sort -u | sed -z 's/\n/,/g;s/^/[/;s/,$/]/;s/$/\n/')" >> ${GITHUB_ENV}
fi
echo "$DIRECTORIES_CHANGED"
- uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
if: contains(env.DIRECTORIES_CHANGED, matrix.fldrpath)
with:
java-version: '17'
distribution: 'zulu'
- name: Publish package
if: contains(env.DIRECTORIES_CHANGED, matrix.fldrpath)
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pwd
mvn clean install -DskipTests --file ${{ matrix.fldrpath }}
mvn -B package --file ${{ matrix.fldrpath }}/pom.xml -Dmaven.test.skip=true
mvn --file ${{ matrix.fldrpath }}/pom.xml deploy -Dmaven.test.skip=true