chore: Add goreleaser

pull/2/head
Karan Sharma 2020-12-18 12:54:57 +05:30
parent 05914cca9e
commit 9f586cc65c
3 changed files with 94 additions and 0 deletions

30
.github/workflows/release.yml vendored 100644
View File

@ -0,0 +1,30 @@
name: goreleaser
on:
push:
tags:
- '*'
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.15
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SNAPCRAFT_TOKEN: ${{ secrets.SNAPCRAFT_TOKEN }}

59
.goreleaser.yml 100644
View File

@ -0,0 +1,59 @@
env:
- GO111MODULE=on
- CGO_ENABLED=0
builds:
- binary: doggo
goos:
- windows
- darwin
- linux
goarch:
- amd64
- arm64
goarm:
- 6
- 7
ldflags:
- -s -w -X "main.buildVersion={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})"
dir: ./cmd/
archives:
- format: tar.gz
files:
- README.md
- LICENSE
# snapcrafts:
# - name_template: "{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
# summary: DNS Command-line client.
# description: |
# doggo is a command-line DNS client written in Go. It supports protocols like DoH, DoT and output formats like JSON.
# grade: stable
# confinement: strict
# publish: true
dockers:
- image_templates:
- "ghcr.io/mr-karan/doggo:{{ .Tag }}"
- "ghcr.io/mr-karan/doggo:latest"
binaries:
- doggo
dockerfile: Dockerfile
build_flag_templates:
- "--build-arg"
- "ARCH=amd64"
- image_templates:
- "ghcr.io/mr-karan/doggo:{{ .Tag }}-arm64v8"
binaries:
- doggo
goarch: arm64
dockerfile: Dockerfile
build_flag_templates:
- "--build-arg"
- "ARCH=arm64v8"
docker_manifests:
- name_template: mr-karan/doggo:{{ .Tag }}
image_templates:
- mr-karan/doggo:{{ .Tag }}-amd64
- mr-karan/doggo:{{ .Tag }}-arm64v8

5
Dockerfile 100644
View File

@ -0,0 +1,5 @@
# Dockerfile
ARG ARCH
FROM ${ARCH}/alpine
COPY doggo /usr/bin/doggo
ENTRYPOINT ["/usr/bin/doggo"]