Skip to content

Commit 828efe0

Browse files
committed
feat!: move edge & proxy to new builder
1 parent edaf537 commit 828efe0

44 files changed

Lines changed: 1028 additions & 193 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.devcontainer.json‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "Example devcontainer for add-on repositories",
3+
"image": "ghcr.io/home-assistant/devcontainer:2-addons",
4+
"appPort": ["7123:8123", "7357:4357"],
5+
"postStartCommand": "bash devcontainer_bootstrap",
6+
"runArgs": ["-e", "GIT_EDITOR=code --wait", "--privileged"],
7+
"containerEnv": {
8+
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
9+
},
10+
"workspaceFolder": "/mnt/supervisor/addons/local/${localWorkspaceFolderBasename}",
11+
"workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind,consistency=cached",
12+
"customizations": {
13+
"vscode": {
14+
"extensions": ["timonwong.shellcheck", "esbenp.prettier-vscode"],
15+
"settings": {
16+
"terminal.integrated.profiles.linux": {
17+
"zsh": {
18+
"path": "/usr/bin/zsh"
19+
}
20+
},
21+
"terminal.integrated.defaultProfile.linux": "zsh",
22+
"editor.formatOnPaste": false,
23+
"editor.formatOnSave": true,
24+
"editor.formatOnType": true,
25+
"files.trimTrailingWhitespace": true
26+
}
27+
}
28+
},
29+
"mounts": [
30+
"type=volume,target=/var/lib/docker",
31+
"type=volume,target=/mnt/supervisor"
32+
]
33+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ updates:
33
- package-ecosystem: "github-actions"
44
directory: "/"
55
schedule:
6-
interval: "daily"
7-
target-branch: dev
6+
interval: weekly
7+
time: "06:00"

‎.github/workflows/builder.yaml‎

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Builder
2+
3+
env:
4+
BUILD_ARGS: "--test"
5+
MONITORED_FILES: "build.yaml config.yaml Dockerfile rootfs"
6+
REGISTRY: ghcr.io
7+
8+
on:
9+
push:
10+
branches:
11+
- master
12+
pull_request:
13+
branches:
14+
- master
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
init:
21+
runs-on: ubuntu-latest
22+
name: Initialize builds
23+
outputs:
24+
changed_addons: ${{ steps.changed_addons.outputs.addons }}
25+
changed: ${{ steps.changed_addons.outputs.changed }}
26+
steps:
27+
- name: Check out the repository
28+
uses: actions/checkout@v6
29+
30+
- name: Get changed files
31+
id: changed_files
32+
uses: tj-actions/changed-files@v47
33+
34+
- name: Find add-on directories
35+
id: addons
36+
uses: home-assistant/actions/helpers/find-addons@master
37+
38+
- name: Get changed add-ons
39+
id: changed_addons
40+
run: |
41+
declare -a changed_addons
42+
for addon in ${{ steps.addons.outputs.addons }}; do
43+
if [[ "${{ steps.changed_files.outputs.all_changed_files }}" =~ $addon ]]; then
44+
for file in ${{ env.MONITORED_FILES }}; do
45+
if [[ "${{ steps.changed_files.outputs.all_changed_files }}" =~ $addon/$file ]]; then
46+
if [[ ! "${changed_addons[@]}" =~ $addon ]]; then
47+
changed_addons+=("\"${addon}\",");
48+
fi
49+
fi
50+
done
51+
fi
52+
done
53+
54+
changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev)
55+
56+
if [[ -n ${changed} ]]; then
57+
echo "Changed add-ons: $changed";
58+
echo "changed=true" >> $GITHUB_OUTPUT;
59+
echo "addons=[$changed]" >> $GITHUB_OUTPUT;
60+
else
61+
echo "No add-on had any monitored files changed (${{ env.MONITORED_FILES }})";
62+
fi
63+
64+
build:
65+
needs: init
66+
runs-on: ubuntu-latest
67+
if: needs.init.outputs.changed == 'true'
68+
name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on
69+
strategy:
70+
matrix:
71+
addon: ${{ fromJson(needs.init.outputs.changed_addons) }}
72+
arch: ["aarch64", "amd64"]
73+
permissions:
74+
contents: read
75+
packages: write
76+
steps:
77+
- name: Check out repository
78+
uses: actions/checkout@v6
79+
80+
- name: Get information
81+
id: info
82+
uses: home-assistant/actions/helpers/info@master
83+
with:
84+
path: "./${{ matrix.addon }}"
85+
86+
- name: Check if add-on should be built
87+
id: check
88+
run: |
89+
if [[ "${{ steps.info.outputs.image }}" == "null" ]]; then
90+
echo "Image property is not defined, skipping build"
91+
echo "build_arch=false" >> $GITHUB_OUTPUT;
92+
elif [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
93+
echo "build_arch=true" >> $GITHUB_OUTPUT;
94+
echo "image=$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)" >> $GITHUB_OUTPUT;
95+
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
96+
echo "BUILD_ARGS=" >> $GITHUB_ENV;
97+
fi
98+
else
99+
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
100+
echo "build_arch=false" >> $GITHUB_OUTPUT;
101+
fi
102+
103+
- name: Login to GitHub Container Registry
104+
if: env.BUILD_ARGS != '--test'
105+
uses: docker/login-action@v3
106+
with:
107+
registry: ${{ env.REGISTRY }}
108+
username: ${{ github.repository_owner }}
109+
password: ${{ secrets.GITHUB_TOKEN }}
110+
111+
- name: Build ${{ matrix.addon }} add-on
112+
if: steps.check.outputs.build_arch == 'true'
113+
uses: home-assistant/builder@2025.09.0
114+
with:
115+
args: |
116+
${{ env.BUILD_ARGS }} \
117+
--${{ matrix.arch }} \
118+
--target /data/${{ matrix.addon }} \
119+
--image "${{ steps.check.outputs.image }}" \
120+
--docker-hub "${{ env.REGISTRY }}/${{ github.repository_owner }}" \
121+
--addon
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Bump version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
addon_folder:
7+
description: "The folder of the add-on to version bump"
8+
required: true
9+
default: "zigbee2mqtt"
10+
type: choice
11+
options: ["zigbee2mqtt"]
12+
arg_name:
13+
description: "The name of the version to bump (without '_VERSION')"
14+
required: true
15+
default: "ZIGBEE2MQTT"
16+
type: string
17+
version:
18+
description: "The new version"
19+
required: true
20+
type: string
21+
changelog:
22+
description: "The changelog to write if needed"
23+
type: string
24+
25+
permissions:
26+
contents: read
27+
28+
jobs:
29+
build:
30+
runs-on: ubuntu-latest
31+
name: Bump ${{ inputs.addon_folder }} add-on ${{ inputs.arg_name }} to ${{ inputs.version }}
32+
permissions:
33+
contents: write
34+
pull-requests: write
35+
steps:
36+
- name: Check out repository
37+
uses: actions/checkout@v6
38+
39+
- name: Bump version & write changelog
40+
run: |
41+
sed -i -E 's/^ ${{ inputs.arg_name }}_VERSION: .*$/ ${{ inputs.arg_name }}_VERSION: "${{ inputs.version }}"/g' ./${{ inputs.addon_folder }}/build.yaml
42+
43+
addonFolderLower=$(echo "${{ inputs.addon_folder }}" | tr '[:upper:]' '[:lower:]')
44+
argNameLower=$(echo "${{ inputs.arg_name }}" | tr '[:upper:]' '[:lower:]')
45+
46+
if [[ "$addonFolderLower" == "$argNameLower" ]]; then
47+
sed -i -E 's/^version: .*$/version: "${{ inputs.version }}"/g' ./${{ inputs.addon_folder }}/config.yaml
48+
fi
49+
50+
if [[ -z "${{ inputs.changelog }}" ]]; then
51+
echo "No changelog to write"
52+
else
53+
echo -e "${{ inputs.changelog }}\n\n$(cat ./${{ inputs.addon_folder }}/CHANGELOG.md)" > ./${{ inputs.addon_folder }}/CHANGELOG.md
54+
fi
55+
56+
branch="${{ inputs.addon_folder }}-${{ inputs.arg_name }}-${{ inputs.version }}"
57+
title="fix: bump ${{ inputs.addon_folder }} add-on ${{ inputs.arg_name }} to ${{ inputs.version }}"
58+
59+
git config --global user.name 'github-actions[bot]'
60+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
61+
git checkout -b "$branch"
62+
git add .
63+
git commit -m "$title" || echo 'Nothing to commit'
64+
git push origin "$branch"
65+
66+
echo -e "${{ inputs.changelog }}" | gh pr create \
67+
--fill \
68+
--base master \
69+
--head $branch \
70+
--title "$title" \
71+
--body-file -
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/lint.yaml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
schedule:
11+
- cron: "0 0 * * *"
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
find:
18+
name: Find add-ons
19+
runs-on: ubuntu-latest
20+
outputs:
21+
addons: ${{ steps.addons.outputs.addons_list }}
22+
steps:
23+
- name: ⤵️ Check out code from GitHub
24+
uses: actions/checkout@v6
25+
26+
- name: 🔍 Find add-on directories
27+
id: addons
28+
uses: home-assistant/actions/helpers/find-addons@master
29+
30+
lint:
31+
name: Lint add-on ${{ matrix.path }}
32+
runs-on: ubuntu-latest
33+
needs: find
34+
strategy:
35+
matrix:
36+
path: ${{ fromJson(needs.find.outputs.addons) }}
37+
steps:
38+
- name: ⤵️ Check out code from GitHub
39+
uses: actions/checkout@v6
40+
41+
- name: 🚀 Run Home Assistant Add-on Lint
42+
uses: frenck/action-addon-linter@v2
43+
with:
44+
path: "./${{ matrix.path }}"
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Manual Builder
2+
3+
env:
4+
REGISTRY: ghcr.io
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
addon_folder:
10+
description: "The folder of the add-on to build"
11+
required: true
12+
default: "zigbee2mqtt-edge"
13+
type: choice
14+
options: ["zigbee2mqtt", "zigbee2mqtt-edge", "zigbee2mqtt-proxy"]
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
name: Build ${{ matrix.arch }} ${{ inputs.addon_folder }} add-on
23+
strategy:
24+
matrix:
25+
arch: ["aarch64", "amd64"]
26+
permissions:
27+
packages: write
28+
steps:
29+
- name: Check out repository
30+
uses: actions/checkout@v6
31+
32+
- name: Get information
33+
id: info
34+
uses: home-assistant/actions/helpers/info@master
35+
with:
36+
path: "./${{ inputs.addon_folder }}"
37+
38+
- name: Check if add-on should be built
39+
id: check
40+
run: |
41+
if [[ "${{ steps.info.outputs.image }}" == "null" ]]; then
42+
echo "Image property is not defined, skipping build"
43+
echo "build_arch=false" >> $GITHUB_OUTPUT;
44+
elif [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
45+
echo "build_arch=true" >> $GITHUB_OUTPUT;
46+
echo "image=$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)" >> $GITHUB_OUTPUT;
47+
else
48+
echo "${{ matrix.arch }} is not a valid arch for ${{ inputs.addon_folder }}, skipping build";
49+
echo "build_arch=false" >> $GITHUB_OUTPUT;
50+
fi
51+
52+
- name: Login to GitHub Container Registry
53+
if: steps.check.outputs.build_arch == 'true'
54+
uses: docker/login-action@v3
55+
with:
56+
registry: ${{ env.REGISTRY }}
57+
username: ${{ github.repository_owner }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Build ${{ inputs.addon_folder }} add-on
61+
if: steps.check.outputs.build_arch == 'true'
62+
uses: home-assistant/builder@2025.09.0
63+
with:
64+
args: |
65+
--${{ matrix.arch }} \
66+
--target /data/${{ inputs.addon_folder }} \
67+
--image "${{ steps.check.outputs.image }}" \
68+
--docker-hub "${{ env.REGISTRY }}/${{ github.repository_owner }}" \
69+
--addon

‎.gitignore‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,3 @@ secrets.json
111111
zigbee2mqtt/rootfs
112112
zigbee2mqtt/Dockerfile
113113
zigbee2mqtt/build.yaml
114-
zigbee2mqtt-edge/rootfs
115-
zigbee2mqtt-edge/Dockerfile
116-
zigbee2mqtt-edge/build.yaml
117-
zigbee2mqtt-local/*

0 commit comments

Comments
 (0)