Skip to content

Commit

Permalink
ci: add release configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Santos committed Jan 3, 2023
1 parent 93f58da commit 711b996
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: build

on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
-
name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
project_name: miio-go
builds:
-
main: ./cmd/miio-go
id: "miio-go"
binary: miio-go
env: [CGO_ENABLED=0]
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
nfpms:
-
maintainer: Marco Santos <[email protected]>
description: An implementation of the miIO home protocol by Xiaomi written in Golang.
homepage: https://github.com/LOQ9/miio-go
license: MIT
formats:
- deb
- rpm
- apk

archives:
-
format: binary

dockers:
-
id: miio-go
image_templates:
- "ghcr.io/loq9/{{ .ProjectName }}:{{ .Tag }}"
- "ghcr.io/loq9/{{ .ProjectName }}:latest"
dockerfile: "Dockerfile.minimal"
13 changes: 13 additions & 0 deletions Dockerfile.minimal
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alpine:3.16

RUN apk update && \
apk add --no-cache curl ca-certificates && \
rm -rf /var/cache/apk/*

WORKDIR /app

ADD miio-go /app/miio-go
RUN chmod u+x /app/miio-go

# Start
ENTRYPOINT [ "/app/miio-go" ]

0 comments on commit 711b996

Please sign in to comment.