Skip to content

Commit

Permalink
Update Github Actions and Goreleaser workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanwichmann committed Mar 28, 2023
1 parent 3692e5b commit 6c5a6e8
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 39 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.17
go-version: 1.20.2

- name: Build
run: go build -v ./...
Expand Down
30 changes: 17 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,28 @@ permissions:
jobs:
goreleaser:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
-
name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
go-version: 1.17
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.2
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

97 changes: 75 additions & 22 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,20 @@ before:
- go mod tidy

builds:
-
env:
- env:
- CGO_ENABLED=0

goos:
- linux
- windows
- darwin
- freebsd

goarch:
- 386
- amd64
- arm
- arm64

goarm:
- 5

gomips:
- hardfloat
- softfloat
targets:
- linux_amd64
- linux_arm_5
- linux_arm_7
- linux_arm64
- windows_amd64
- darwin_amd64
- darwin_arm64

archives:
-
format_overrides:
- format_overrides:
- goos: windows
format: zip

Expand All @@ -39,6 +27,8 @@ archives:
- gui/*
- etc/*

rlcp: true

checksum:
name_template: 'checksums.txt'

Expand All @@ -51,3 +41,66 @@ changelog:
exclude:
- '^docs:'
- '^test:'

dockers:
- image_templates: ["stefanwichmann/{{ .ProjectName }}:{{ .Version }}-amd64"]
goos: linux
goarch: amd64
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/stefanwichmann/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/stefanwichmann/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=MIT

- image_templates: ["stefanwichmann/{{ .ProjectName }}:{{ .Version }}-armv7"]
goos: linux
goarch: arm
goarm: 7
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- --platform=linux/arm/v7
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/stefanwichmann/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/stefanwichmann/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=MIT

- image_templates: ["stefanwichmann/{{ .ProjectName }}:{{ .Version }}-arm64"]
goos: linux
goarch: arm64
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- --platform=linux/arm64/v8
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/stefanwichmann/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/stefanwichmann/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=MIT

docker_manifests:
- name_template: stefanwichmann/{{ .ProjectName }}:{{ .Version }}
image_templates:
- stefanwichmann/{{ .ProjectName }}:{{ .Version }}-amd64
- stefanwichmann/{{ .ProjectName }}:{{ .Version }}-armv7
- stefanwichmann/{{ .ProjectName }}:{{ .Version }}-arm64

- name_template: stefanwichmann/{{ .ProjectName }}:latest
image_templates:
- stefanwichmann/{{ .ProjectName }}:{{ .Version }}-amd64
- stefanwichmann/{{ .ProjectName }}:{{ .Version }}-armv7
- stefanwichmann/{{ .ProjectName }}:{{ .Version }}-arm64
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ WORKDIR /opt/kelvin
VOLUME /etc/opt/kelvin

RUN apk --no-cache add ca-certificates tzdata && update-ca-certificates
COPY dist/kelvin-linux-amd64-v* /opt/kelvin/
COPY kelvin /opt/kelvin/

ENTRYPOINT /opt/kelvin/kelvin -enableWebInterface -configuration=/etc/opt/kelvin/config.json 2>&1 | tee /var/log/kelvin.log

0 comments on commit 6c5a6e8

Please sign in to comment.