-
Notifications
You must be signed in to change notification settings - Fork 345
115 lines (107 loc) · 3.89 KB
/
Copy pathbuild-app.yaml
File metadata and controls
115 lines (107 loc) · 3.89 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Build app
on:
workflow_call:
inputs:
app:
required: true
type: string
publish:
required: true
type: boolean
jobs:
prepare:
name: Prepare
if: github.repository == 'home-assistant/apps-example'
runs-on: ubuntu-latest
outputs:
architectures: ${{ steps.info.outputs.architectures }}
build_matrix: ${{ steps.matrix.outputs.matrix }}
image_name: ${{ steps.normalize.outputs.image_name }}
name: ${{ steps.normalize.outputs.name }}
description: ${{ steps.normalize.outputs.description }}
url: ${{ steps.normalize.outputs.url }}
registry_prefix: ${{ steps.normalize.outputs.registry_prefix }}
version: ${{ steps.normalize.outputs.version }}
steps:
- name: Check out the repository
uses: actions/checkout@v6.0.3
- name: Get app information
id: info
uses: home-assistant/actions/helpers/info@master
with:
path: "./${{ inputs.app }}"
- name: Normalize app information
id: normalize
run: |
image=${{ steps.info.outputs.image }}
echo "image_name=${image##*/}" >> "$GITHUB_OUTPUT"
echo "registry_prefix=${image%/*}" >> "$GITHUB_OUTPUT"
version=${{ steps.info.outputs.version }}
echo "version=${version}" >> "$GITHUB_OUTPUT"
name=${{ steps.info.outputs.name }}
echo "name=${name}" >> "$GITHUB_OUTPUT"
description=${{ steps.info.outputs.description }}
echo "description=${description}" >> "$GITHUB_OUTPUT"
url=${{ steps.info.outputs.url }}
if [[ -n "$url" && "$url" != "null" ]]; then
echo "url=${url}" >> "$GITHUB_OUTPUT"
fi
- name: Prepare build matrix
id: matrix
uses: home-assistant/builder/actions/prepare-multi-arch-matrix@2026.03.2
with:
architectures: ${{ steps.info.outputs.architectures }}
image-name: ${{ steps.normalize.outputs.image_name }}
registry-prefix: ${{ steps.normalize.outputs.registry_prefix }}
build:
name: Build ${{ matrix.arch }} image
needs: prepare
runs-on: ${{ matrix.os }}
permissions:
contents: read
id-token: write
packages: write
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare.outputs.build_matrix) }}
steps:
- name: Check out the repository
uses: actions/checkout@v6.0.3
with:
persist-credentials: false
- name: Build image
uses: home-assistant/builder/actions/build-image@2026.03.2
with:
arch: ${{ matrix.arch }}
container-registry-password: ${{ secrets.GITHUB_TOKEN }}
context: "./${{ inputs.app }}"
image: ${{ matrix.image }}
image-tags: |
${{ needs.prepare.outputs.version }}
latest
labels: |
io.hass.type=app
io.hass.name=${{ needs.prepare.outputs.name }}
io.hass.description=${{ needs.prepare.outputs.description }}
${{ needs.prepare.outputs.url && format('io.hass.url={0}', needs.prepare.outputs.url) || '' }}
push: ${{ inputs.publish }}
version: ${{ needs.prepare.outputs.version }}
manifest:
name: Publish multi-arch manifest
needs: [prepare, build]
if: inputs.publish
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
steps:
- name: Publish multi-arch manifest
uses: home-assistant/builder/actions/publish-multi-arch-manifest@2026.03.2
with:
architectures: ${{ needs.prepare.outputs.architectures }}
container-registry-password: ${{ secrets.GITHUB_TOKEN }}
image-name: ${{ needs.prepare.outputs.image_name }}
image-tags: |
${{ needs.prepare.outputs.version }}
latest
registry-prefix: ${{ needs.prepare.outputs.registry_prefix }}