Skip to content

Commit

Permalink
Fixed multi arch GH build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzen committed Jan 9, 2024
1 parent 5c639a4 commit c1f720d
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 44 deletions.
31 changes: 3 additions & 28 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,16 @@
name: Lint

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"
on: [push, pull_request, workflow_dispatch]

jobs:
find:
name: Find add-ons
runs-on: ubuntu-latest
outputs:
addons: ${{ steps.addons.outputs.addons_list }}
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.1

- name: 🔍 Find add-on directories
id: addons
uses: home-assistant/actions/helpers/find-addons@master

lint:
name: Lint add-on ${{ matrix.path }}
name: Lint
runs-on: ubuntu-latest
needs: find
strategy:
matrix:
path: ${{ fromJson(needs.find.outputs.addons) }}
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.1

- name: 🚀 Run Home Assistant Add-on Lint
uses: frenck/action-addon-linter@v2.15
with:
path: "./${{ matrix.path }}"
path: ./pwsmqttdispatcher
16 changes: 12 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,29 @@ on:

jobs:
publish:
name: Publish
name: Build and publish
runs-on: ubuntu-latest
strategy:
matrix:
arch: ["aarch64", "amd64", "armhf", "armv7", "i386"]

steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Login to GH Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish
uses: home-assistant/builder@2023.12.0

- name: Publish ${{ matrix.arch }}
uses: home-assistant/builder@2024.01.0
with:
args: |
--all \
--addon \
--${{ matrix.arch }} \
--target /data/pwsmqttdispatcher \
--image "${{ matrix.arch }}-pwsmqttdispatcher" \
--docker-hub "ghcr.io/${{ github.repository_owner }}"
8 changes: 6 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ jobs:
build:
name: Test build
runs-on: ubuntu-latest
strategy:
matrix:
arch: ["aarch64", "amd64", "armhf", "armv7", "i386"]
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Test build
uses: home-assistant/builder@2023.12.0
uses: home-assistant/builder@2024.01.0
with:
args: |
--test \
--all \
--${{ matrix.arch }} \
--addon \
--target /data/pwsmqttdispatcher \
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# PWS to MQTT dispatcher addon for Home Assistant

[![Lint](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/lint.yaml/badge.svg)](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/lint.yaml)
[![Builder](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/builder.yaml/badge.svg)](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/builder.yaml)

This Home Assistant add-on retrieves live weather data from a WH2600 personal weather station (PWS) and publishes it to an MQTT topic where HAAS can access it as sensor information.
[![Test](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/test.yaml/badge.svg)](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/test.yaml)

This add-on retrieves live weather data from a WH2600 personal weather station (PWS) and publishes it to an MQTT topic where HAAS can access it as sensor information.

Supported weather stations: Renkforce WH2600, Froggit units.

Expand Down
5 changes: 5 additions & 0 deletions pwsmqttdispatcher/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.1.24

- NaN values received from the PWS are now passed through to MQTT, instead of throwing an error.
- Fixed multi arch build

## 0.1.22

- Image repository changed to ghcr.io, addon now available on all supported HASS platforms
Expand Down
9 changes: 3 additions & 6 deletions pwsmqttdispatcher/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
ARG BUILD_FROM

FROM golang:1.21 AS build
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.21 AS build
WORKDIR /root/
COPY ./src/ .
RUN CGO_ENABLED=0 GO111MODULE=on go build
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s"


FROM $BUILD_FROM

ARG TEMPIO_VERSION
ARG BUILD_ARCH


# Execute during the build of the image
RUN \
curl -sSLf -o /usr/bin/tempio \
Expand All @@ -23,5 +22,3 @@ COPY rootfs /

# Copy pwsmqttdispatcher binary
COPY --from=build /root/pwsmqttdispatcher /usr/bin

# ENTRYPOINT [ "/bin/sh" ]
3 changes: 3 additions & 0 deletions pwsmqttdispatcher/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ labels:
org.opencontainers.image.licenses: "Apache License 2.0"
args:
TEMPIO_VERSION: "2021.09.0"
codenotary:
signer: peter@froggle.org
base_image: notary@home-assistant.io
4 changes: 2 additions & 2 deletions pwsmqttdispatcher/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
name: PWS to MQTT dispatcher addon
version: "0.1.22"
version: "0.1.24"
slug: pwsmqttdispatcher
description: Push weather station (PWS) data to MQTT
url: "https://github.com/peterzen/hass-pws-mqtt-addon/tree/main/pwsmqttdispatcher"
Expand All @@ -23,6 +23,6 @@ schema:
mqtt_client_id: "str?"
fetch_interval: "int"
debug_enabled: "bool"
image: "ghcr.io/peterzen/pwsmqttdispatcher"
image: "ghcr.io/peterzen/{arch}-pwsmqttdispatcher"
services:
- mqtt:want

0 comments on commit c1f720d

Please sign in to comment.