Skip to content

Commit f5baeaf

Browse files
committed
chore: add goreleaser
1 parent 6c64954 commit f5baeaf

File tree

3 files changed

+119
-1
lines changed

3 files changed

+119
-1
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.log
33
*.pid
44
*.retry
5+
*.out
56
*.tgz
67
*.zip
78
*.pem
@@ -36,6 +37,9 @@ cache/
3637
## Grafanactl
3738
grafanactl.yaml
3839

40+
## Goreleaser
41+
!.goreleaser.yml
42+
3943
## Go
4044
go.work
4145
go.work.sum

.goreleaser.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
version: 2
2+
3+
builds:
4+
- binary: gofana
5+
main: ./cmd/gofana/main.go
6+
env:
7+
- CGO_ENABLED=0
8+
goos:
9+
- windows
10+
- darwin
11+
- linux
12+
goarch:
13+
- amd64
14+
- arm64
15+
goarm:
16+
- '7'
17+
flags:
18+
- -trimpath
19+
- -tags=safe
20+
ldflags:
21+
- -s -w -X github.com/foomo/gofana/cmd/gofana/command.version={{.Version}}
22+
23+
release:
24+
prerelease: auto
25+
26+
archives:
27+
- formats: [ tar.gz ]
28+
format_overrides:
29+
- goos: windows
30+
formats: [ zip ]
31+
32+
changelog:
33+
use: github-native
34+
35+
brews:
36+
- repository:
37+
owner: foomo
38+
name: homebrew-tap
39+
caveats: "gofana --help"
40+
homepage: "https://github.com/foomo/gofana"
41+
description: "CLI utility to manage Grafana resources"
42+
test: |
43+
system "#{bin}/gofana --version"
44+
45+
dockers:
46+
- use: buildx
47+
goos: linux
48+
goarch: amd64
49+
dockerfile: Dockerfile
50+
image_templates:
51+
- '{{ if eq .Prerelease "" }}foomo/gofana:latest-amd64{{ end }}'
52+
- 'foomo/gofana:{{ .Version }}-amd64'
53+
- '{{ if eq .Prerelease "" }}foomo/gofana:{{ .Major }}-amd64{{ end }}'
54+
- '{{ if eq .Prerelease "" }}foomo/gofana:{{ .Major }}.{{ .Minor }}-amd64{{ end }}'
55+
build_flag_templates:
56+
- '--pull'
57+
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
58+
- '--label=org.opencontainers.image.title={{.ProjectName}}'
59+
- '--label=org.opencontainers.image.description=CLI utility to manage Grafana resources'
60+
- '--label=org.opencontainers.image.source={{.GitURL}}'
61+
- '--label=org.opencontainers.image.url={{.GitURL}}'
62+
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
63+
- '--label=org.opencontainers.image.created={{.Date}}'
64+
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
65+
- '--label=org.opencontainers.image.version={{.Version}}'
66+
- '--platform=linux/amd64'
67+
68+
- use: buildx
69+
goos: linux
70+
goarch: arm64
71+
dockerfile: Dockerfile
72+
image_templates:
73+
- '{{ if eq .Prerelease "" }}foomo/gofana:latest-arm64{{ end }}'
74+
- 'foomo/gofana:{{ .Version }}-arm64'
75+
- '{{ if eq .Prerelease "" }}foomo/gofana:{{ .Major }}-arm64{{ end }}'
76+
- '{{ if eq .Prerelease "" }}foomo/gofana:{{ .Major }}.{{ .Minor }}-arm64{{ end }}'
77+
build_flag_templates:
78+
- '--pull'
79+
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
80+
- '--label=org.opencontainers.image.title={{.ProjectName}}'
81+
- '--label=org.opencontainers.image.description=CLI utility to manage Grafana resources'
82+
- '--label=org.opencontainers.image.source={{.GitURL}}'
83+
- '--label=org.opencontainers.image.url={{.GitURL}}'
84+
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
85+
- '--label=org.opencontainers.image.created={{.Date}}'
86+
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
87+
- '--label=org.opencontainers.image.version={{.Version}}'
88+
- '--platform=linux/arm64'
89+
90+
docker_manifests:
91+
# basic
92+
- name_template: 'foomo/gofana:latest'
93+
image_templates:
94+
- 'foomo/gofana:latest-amd64'
95+
- 'foomo/gofana:latest-arm64'
96+
skip_push: auto
97+
98+
- name_template: 'foomo/gofana:{{ .Version }}'
99+
image_templates:
100+
- 'foomo/gofana:{{ .Version }}-amd64'
101+
- 'foomo/gofana:{{ .Version }}-arm64'
102+
skip_push: auto
103+
104+
- name_template: 'foomo/gofana:{{ .Major }}'
105+
image_templates:
106+
- 'foomo/gofana:{{ .Major }}-amd64'
107+
- 'foomo/gofana:{{ .Major }}-arm64'
108+
skip_push: auto
109+
110+
- name_template: 'foomo/gofana:{{ .Major }}.{{ .Minor }}'
111+
image_templates:
112+
- 'foomo/gofana:{{ .Major }}.{{ .Minor }}-amd64'
113+
- 'foomo/gofana:{{ .Major }}.{{ .Minor }}-arm64'
114+
skip_push: auto

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ lint.fix:
6161
## Run tests
6262
test:
6363
@echo "〉go test"
64-
@$(foreach mod,$(GOMODS), (cd $(dir $(mod)) && echo "📂 $(dir $(mod))" && GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out -race) &&) true
64+
@$(foreach mod,$(GOMODS), (cd $(dir $(mod)) && echo "📂 $(dir $(mod))" && GO_TEST_TAGS=-skip go test -tags=safe -coverprofile=coverage.out -race ./...) &&) true
6565

6666
.PHONY: outdated
6767
## Show outdated direct dependencies

0 commit comments

Comments
 (0)