Skip to content

Commit 880f45f

Browse files
committed
feat: add goreleaser for binary distribution
1 parent bccb174 commit 880f45f

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

.github/workflows/go.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ name: Go
66
on:
77
push:
88
branches: ["main"]
9+
tags:
10+
- "v*"
911
pull_request:
1012
branches: ["main"]
1113

@@ -25,3 +27,13 @@ jobs:
2527

2628
- name: Test
2729
run: go test -v ./...
30+
31+
- name: Run GoReleaser
32+
uses: goreleaser/goreleaser-action@v6
33+
if: success() && startsWith(github.ref, 'refs/tags/')
34+
with:
35+
distribution: goreleaser
36+
version: "~> v2"
37+
args: release --clean
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,5 @@ $RECYCLE.BIN/
205205
# Windows shortcuts
206206
*.lnk
207207

208-
# End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux,intellij+all,visualstudiocode,go
208+
# End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux,intellij+all,visualstudiocode,go
209+
dist/

.goreleaser.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
# You may remove this if you don't use go modules.
6+
- go mod tidy
7+
8+
builds:
9+
- env:
10+
- CGO_ENABLED=0
11+
goos:
12+
- linux
13+
- windows
14+
- darwin
15+
16+
archives:
17+
- format: tar.gz
18+
# this name template makes the OS and Arch compatible with the results of `uname`.
19+
name_template: >-
20+
{{ .ProjectName }}_
21+
{{- title .Os }}_
22+
{{- if eq .Arch "amd64" }}x86_64
23+
{{- else if eq .Arch "386" }}i386
24+
{{- else }}{{ .Arch }}{{ end }}
25+
{{- if .Arm }}v{{ .Arm }}{{ end }}
26+
# use zip for windows archives
27+
format_overrides:
28+
- goos: windows
29+
format: zip
30+
31+
changelog:
32+
sort: asc
33+
filters:
34+
exclude:
35+
- "^docs:"
36+
- "^test:"

0 commit comments

Comments
 (0)