-
Notifications
You must be signed in to change notification settings - Fork 4
52 lines (49 loc) · 1.68 KB
/
wc-ci.yaml
File metadata and controls
52 lines (49 loc) · 1.68 KB
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
on:
workflow_call:
jobs:
determine-apps:
runs-on: ubuntu-latest
outputs:
apps: ${{ steps.set-apps.outputs.apps }}
steps:
- name: Checkout source code
uses: actions/checkout@v4.2.2
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Determine changed apps
id: set-apps
run: |
apps=()
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
for file in $changed_files; do
echo "Changed file: ${file}"
if grep -q '^settings.gradle.kts$' <<< "${file}"; then
apps+=("api" "api-backoffice")
elif grep -qE '^gradle/|^exception/' <<< "${file}"; then
apps+=("api" "api-backoffice")
else
if grep -qE '^api-backoffice/|^core-backoffice/|^infra-backoffice/' <<< "${file}"; then
apps+=("api-backoffice")
elif grep -qE '^api/|^core/|^infra/' <<< "${file}"; then
apps+=("api")
fi
fi
done
apps=$(echo "${apps[@]}" | tr ' ' '\n' | sort | uniq | tr '\n' ',')
apps=${apps%,}
echo "apps=$(jq -nc --arg apps "$apps" '$apps | split(",")')" >> $GITHUB_OUTPUT
- name: Print extracted apps
run: |
echo "Extracted apps: ${{ steps.set-apps.outputs.apps }}"
build:
needs: determine-apps
if: ${{ needs.determine-apps.outputs.apps != '[]' }}
strategy:
matrix:
app: ${{ fromJson(needs.determine-apps.outputs.apps) }}
uses: ./.github/workflows/wc-ci-01-build.yaml
name: "🏗️"
with:
app: ${{ matrix.app }}
secrets: inherit