Skip to content

Reflecting the actual device check results for Relay Switch 1,1PM,2PM #7

Reflecting the actual device check results for Relay Switch 1,1PM,2PM

Reflecting the actual device check results for Relay Switch 1,1PM,2PM #7

name: Publish Docker image
on:
push:
tags:
- 'v*'
jobs:
build_app:
name: Build and Push Docker image
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: "aarch64"
platform: "linux/arm64"
rid: "linux-musl-arm64"
useQEMU: true
- arch: "amd64"
platform: "linux/amd64"
rid: "linux-musl-x64"
useQEMU: false
- arch: "armv7"
platform: "linux/arm/v7"
rid: "linux-musl-arm"
useQEMU: true
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Build and Publish
run: |
mkdir ./_compile_self/${{ matrix.arch }}
dotnet restore "./src/SwitchBotMqttApp/SwitchBotMqttApp.csproj"
dotnet publish "./src/SwitchBotMqttApp/SwitchBotMqttApp.csproj" -r ${{ matrix.rid }} -p:PublishSingleFile=true --self-contained false -c Release -o "./_compile_self/${{ matrix.arch }}" --no-restore
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
if: ${{ matrix.useQEMU }}
uses: docker/setup-qemu-action@v3
- name: Extract metadata (tags, labels) for Docker ${{ matrix.arch }}
id: meta
uses: docker/metadata-action@v5
with:
images: |
hsakoh/switchbotmqtt-${{ matrix.arch }}
ghcr.io/hsakoh/switchbotmqtt-${{ matrix.arch }}
tags: |
latest
type=semver,pattern={{version}}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}/
- name: Build and push Docker images ${{ matrix.arch }}
id: push
uses: docker/build-push-action@v6
with:
context: ./_compile_self
platforms: ${{ matrix.platform }}
build-args: |
BUILD_FROM=ghcr.io/home-assistant/${{ matrix.arch }}-base:latest
BUILD_ARCH=${{ matrix.arch }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}