-
Notifications
You must be signed in to change notification settings - Fork 339
81 lines (71 loc) · 2.14 KB
/
builder.yaml
File metadata and controls
81 lines (71 loc) · 2.14 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
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
name: Builder
env:
MONITORED_FILES: "config.json config.yaml config.yml Dockerfile rootfs"
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: read
jobs:
init:
name: Initialize builds
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.filter.outputs.changed }}
changed_apps: ${{ steps.filter.outputs.changed_apps }}
steps:
- name: Check out the repository
uses: actions/checkout@v6.0.2
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@v47
- name: Find app directories
id: apps
uses: home-assistant/actions/helpers/find-addons@master
- name: Filter changed apps
id: filter
env:
APPS: ${{ steps.apps.outputs.addons }}
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
run: |
changed_apps=()
# If the workflow file itself changed, rebuild all apps
if [[ "${CHANGED_FILES}" =~ \.github/workflows/(builder|build-app)\.yaml ]]; then
changed_apps=(${APPS})
else
for app in ${APPS}; do
for file in ${MONITORED_FILES}; do
if [[ "${CHANGED_FILES}" =~ ${app}/${file} ]]; then
changed_apps+=("${app}")
break
fi
done
done
fi
if [[ ${#changed_apps[@]} -gt 0 ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "changed_apps=$(jq -nc '$ARGS.positional' --args "${changed_apps[@]}")" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
build-app:
name: Build ${{ matrix.app }}
needs: init
if: needs.init.outputs.changed == 'true'
permissions:
contents: read
id-token: write
packages: write
strategy:
fail-fast: false
matrix:
app: ${{ fromJSON(needs.init.outputs.changed_apps) }}
uses: ./.github/workflows/build-app.yaml
with:
app: ${{ matrix.app }}
publish: ${{ github.event_name == 'push' }}
secrets: inherit