ci: add goreleaser setup

This commit is contained in:
2022-05-24 00:26:14 +01:00
parent 64c234f07c
commit a5300f753b
3 changed files with 134 additions and 0 deletions

View File

@@ -19,3 +19,31 @@ jobs:
./bin/dotkatapult --port=8080 & ./bin/dotkatapult --port=8080 &
curl --silent --retry 10 --retry-delay 1 --retry-connrefused \ curl --silent --retry 10 --retry-delay 1 --retry-connrefused \
http://localhost:8080/ http://localhost:8080/
release:
runs-on: ubuntu-latest
needs: [test]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- name: Docker Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

100
.goreleaser.yml Normal file
View File

@@ -0,0 +1,100 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- "-s -w"
goos:
- "darwin"
- "freebsd"
- "linux"
- "windows"
goarch:
- "amd64"
- "386"
- "arm"
- "arm64"
goarm:
- "6"
- "7"
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
dockers:
- image_templates:
- "ghcr.io/jimeh/dotkatapult:{{ .Version }}-amd64"
- "ghcr.io/jimeh/dotkatapult:latest-amd64"
dockerfile: Dockerfile.goreleaser
use: buildx
goos: linux
goarch: amd64
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "ghcr.io/jimeh/dotkatapult:{{ .Version }}-386"
- "ghcr.io/jimeh/dotkatapult:latest-386"
dockerfile: Dockerfile.goreleaser
use: buildx
goos: linux
goarch: "386"
build_flag_templates:
- "--platform=linux/386"
- image_templates:
- "ghcr.io/jimeh/dotkatapult:{{ .Version }}-arm64"
- "ghcr.io/jimeh/dotkatapult:latest-arm64"
use: buildx
goos: linux
goarch: arm64
dockerfile: Dockerfile.goreleaser
build_flag_templates:
- "--platform=linux/arm64"
- image_templates:
- "ghcr.io/jimeh/dotkatapult:{{ .Version }}-armv6"
- "ghcr.io/jimeh/dotkatapult:latest-armv6"
use: buildx
goos: linux
goarch: arm
goarm: "6"
dockerfile: Dockerfile.goreleaser
build_flag_templates:
- "--platform=linux/arm/v6"
- image_templates:
- "ghcr.io/jimeh/dotkatapult:{{ .Version }}-armv7"
- "ghcr.io/jimeh/dotkatapult:latest-armv7"
use: buildx
goos: linux
goarch: arm
goarm: "7"
dockerfile: Dockerfile.goreleaser
build_flag_templates:
- "--platform=linux/arm/v7"
docker_manifests:
- name_template: ghcr.io/jimeh/dotkatapult:{{ .Version }}
image_templates:
- ghcr.io/jimeh/dotkatapult:{{ .Version }}-amd64
- ghcr.io/jimeh/dotkatapult:{{ .Version }}-386
- ghcr.io/jimeh/dotkatapult:{{ .Version }}-arm64
- ghcr.io/jimeh/dotkatapult:{{ .Version }}-armv6
- ghcr.io/jimeh/dotkatapult:{{ .Version }}-armv7
- name_template: ghcr.io/jimeh/dotkatapult:latest
image_templates:
- ghcr.io/jimeh/dotkatapult:latest-amd64
- ghcr.io/jimeh/dotkatapult:latest-386
- ghcr.io/jimeh/dotkatapult:latest-arm64
- ghcr.io/jimeh/dotkatapult:latest-armv6
- ghcr.io/jimeh/dotkatapult:latest-armv7

6
Dockerfile.goreleaser Normal file
View File

@@ -0,0 +1,6 @@
FROM scratch
COPY ./dotkatapult /
ENV PORT 8080
EXPOSE 8080
WORKDIR /
CMD ["/dotkatapult"]