Skip to content

Commit 5316c95

Browse files
committed
chore(CI): Configure cross-platform builds and packaging with goreleaser
- Add a new file `.goreleaser.yaml` - Define build configurations for different OS and architecture combinations - Add flags and ldflags for build configuration - Define binary name template for archives - Define checksum template for checksums - Define snapshot name template
1 parent f5f545e commit 5316c95

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.goreleaser.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
5+
builds:
6+
- env:
7+
- CGO_ENABLED=0
8+
goos:
9+
- darwin
10+
- linux
11+
- windows
12+
- freebsd
13+
goarch:
14+
- amd64
15+
- arm
16+
- arm64
17+
goarm:
18+
- "5"
19+
- "6"
20+
- "7"
21+
ignore:
22+
- goos: darwin
23+
goarch: arm
24+
- goos: darwin
25+
goarch: ppc64le
26+
- goos: darwin
27+
goarch: s390x
28+
- goos: windows
29+
goarch: ppc64le
30+
- goos: windows
31+
goarch: s390x
32+
- goos: windows
33+
goarch: arm
34+
goarm: "5"
35+
- goos: windows
36+
goarch: arm
37+
goarm: "6"
38+
- goos: windows
39+
goarch: arm
40+
goarm: "7"
41+
- goos: windows
42+
goarch: arm64
43+
- goos: freebsd
44+
goarch: ppc64le
45+
- goos: freebsd
46+
goarch: s390x
47+
- goos: freebsd
48+
goarch: arm
49+
goarm: "5"
50+
- goos: freebsd
51+
goarch: arm
52+
goarm: "6"
53+
- goos: freebsd
54+
goarch: arm
55+
goarm: "7"
56+
- goos: freebsd
57+
goarch: arm64
58+
flags:
59+
- -trimpath
60+
ldflags:
61+
- -s -w
62+
binary: >-
63+
{{ .ProjectName }}-
64+
{{- if .IsSnapshot }}{{ .Branch }}-
65+
{{- else }}{{- .Version }}-{{ end }}
66+
{{- .Os }}-
67+
{{- if eq .Arch "amd64" }}amd64
68+
{{- else if eq .Arch "amd64_v1" }}amd64
69+
{{- else if eq .Arch "386" }}386
70+
{{- else }}{{ .Arch }}{{ end }}
71+
{{- if .Arm }}-{{ .Arm }}{{ end }}
72+
no_unique_dist_dir: true
73+
74+
archives:
75+
- format: binary
76+
name_template: "{{ .Binary }}"
77+
allow_different_binary_count: true
78+
79+
checksum:
80+
name_template: 'checksums.txt'
81+
82+
snapshot:
83+
name_template: "{{ incpatch .Version }}"

0 commit comments

Comments
 (0)