Skip to content

Commit c328009

Browse files
committed
fix: push correct version tag so HA supervisor can pull image
HA supervisor fetches image as image:version (e.g. :0.2.1). Workflow now pushes both :version and :latest tags on every build. Also reads version from config.yaml instead of hardcoding.
1 parent d1a7f62 commit c328009

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

.github/workflows/build.yaml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,35 @@ jobs:
3535
- name: Get version
3636
id: version
3737
run: |
38-
if [[ "${{ github.event_name }}" == "release" ]]; then
39-
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
40-
else
41-
echo "version=dev" >> $GITHUB_OUTPUT
42-
fi
38+
VERSION=$(jq -r '.version' meshcentral/config.yaml)
39+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
40+
41+
- name: Set image tags
42+
id: tags
43+
run: |
44+
IMAGE="ghcr.io/${{ github.repository_owner }}/meshcentral-addon-${{ matrix.arch }}"
45+
VERSION="${{ steps.version.outputs.version }}"
46+
# HA supervisor henter image:version — vi pusher både version og latest
47+
echo "tags=${IMAGE}:${VERSION},${IMAGE}:latest" >> $GITHUB_OUTPUT
48+
49+
- name: Set platform
50+
id: platform
51+
run: |
52+
case "${{ matrix.arch }}" in
53+
amd64) echo "platform=linux/amd64" >> $GITHUB_OUTPUT ;;
54+
aarch64) echo "platform=linux/arm64" >> $GITHUB_OUTPUT ;;
55+
armhf) echo "platform=linux/arm/v6" >> $GITHUB_OUTPUT ;;
56+
armv7) echo "platform=linux/arm/v7" >> $GITHUB_OUTPUT ;;
57+
i386) echo "platform=linux/386" >> $GITHUB_OUTPUT ;;
58+
esac
4359
4460
- name: Build and push
4561
uses: docker/build-push-action@v5
4662
with:
4763
context: ./meshcentral
4864
file: ./meshcentral/Dockerfile
49-
platforms: linux/${{ matrix.arch == 'amd64' && 'amd64' || matrix.arch == 'aarch64' && 'arm64' || matrix.arch == 'armhf' && 'arm/v6' || matrix.arch == 'armv7' && 'arm/v7' || '386' }}
65+
platforms: ${{ steps.platform.outputs.platform }}
5066
push: true
51-
tags: ghcr.io/${{ github.repository_owner }}/meshcentral-addon-${{ matrix.arch }}:${{ steps.version.outputs.version }}
67+
tags: ${{ steps.tags.outputs.tags }}
5268
build-args: |
5369
BUILD_FROM=ghcr.io/home-assistant/${{ matrix.arch }}-base:latest

0 commit comments

Comments
 (0)