-
Notifications
You must be signed in to change notification settings - Fork 2
98 lines (85 loc) · 2.96 KB
/
Copy pathbuild.yaml
File metadata and controls
98 lines (85 loc) · 2.96 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
name: Build and publish add-on
on:
push:
branches: [main]
paths:
- "meshcentral/**"
- "CHANGELOG.md"
release:
types: [published]
jobs:
sync-changelog:
name: Sync CHANGELOG to add-on folder
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy CHANGELOG.md to add-on subfolder
run: cp CHANGELOG.md meshcentral/CHANGELOG.md
- name: Commit if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git diff --quiet meshcentral/CHANGELOG.md || (
git add meshcentral/CHANGELOG.md &&
git commit -m "chore: sync CHANGELOG.md to add-on subfolder [skip ci]"
)
- name: Push
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
build:
needs: sync-changelog
name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
arch: [aarch64, amd64, armhf, armv7, i386]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get version
id: version
run: |
VERSION=$(jq -r '.version' meshcentral/config.yaml)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Set image tags
id: tags
run: |
IMAGE="ghcr.io/${{ github.repository_owner }}/meshcentral-addon-${{ matrix.arch }}"
VERSION="${{ steps.version.outputs.version }}"
# HA supervisor henter image:version — vi pusher både version og latest
echo "tags=${IMAGE}:${VERSION},${IMAGE}:latest" >> $GITHUB_OUTPUT
- name: Set platform
id: platform
run: |
case "${{ matrix.arch }}" in
amd64) echo "platform=linux/amd64" >> $GITHUB_OUTPUT ;;
aarch64) echo "platform=linux/arm64" >> $GITHUB_OUTPUT ;;
armhf) echo "platform=linux/arm/v6" >> $GITHUB_OUTPUT ;;
armv7) echo "platform=linux/arm/v7" >> $GITHUB_OUTPUT ;;
i386) echo "platform=linux/386" >> $GITHUB_OUTPUT ;;
esac
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./meshcentral
file: ./meshcentral/Dockerfile
platforms: ${{ steps.platform.outputs.platform }}
push: true
tags: ${{ steps.tags.outputs.tags }}
build-args: |
BUILD_FROM=ghcr.io/home-assistant/${{ matrix.arch }}-base:latest