Skip to content

Fix target OS

Fix target OS #17

Workflow file for this run

name: Build
on: [push]
jobs:
compile:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64, mips]
os: [darwin, linux]
exclude:
- arch: mips
os: darwin
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Build
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -tags netgo,osusergo
- uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.os }}-${{ matrix.arch }}
path: mdns2mqtt
if-no-files-found: error
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Build
run: go build -tags netgo,osusergo
- name: Format
run: test -z $(gofmt -l .) || (gofmt -d . && exit 1)
- uses: actions/upload-artifact@v4
with:
name: binary
path: mdns2mqtt
if-no-files-found: error
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and load
uses: docker/build-push-action@v5
with:
context: .
outputs: type=docker,dest=/tmp/image.tar
tags: invlid/mdns2mqtt:latest
- uses: actions/upload-artifact@v4
with:
name: docker-image
path: /tmp/image.tar
if-no-files-found: error
publish:
needs: build
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: docker-image
path: /tmp
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Load image
run: |
docker load --input /tmp/image.tar
- name: Push image
run: |
docker push invlid/mdns2mqtt:latest