-
Notifications
You must be signed in to change notification settings - Fork 681
/
.goreleaser.yaml
75 lines (69 loc) · 1.87 KB
/
.goreleaser.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
project_name: PrometheusAlert
env:
- GO11MODULE=on
- GO111MODULE=on
- GOPROXY=https://goproxy.io
# go-sqlite3需要启用cgo
# cgo比较麻烦,交叉编译需要安装特定架构gcc来支持
- CGO_ENABLED=1
before:
hooks:
- go mod tidy
- go mod vendor
builds:
- id: build-linux
main: main.go
binary: PrometheusAlert
ldflags: -s -w -X main.Version=${{.Version}} -X main.Revision={{.ShortCommit}} -X main.BuildDate={{.Date}} -X main.BuildUser=goreleaser
goos:
- linux
goarch:
- amd64
# 在linux上交叉编译windows cgo需要mingw64-gcc模块
- id: build-windows
main: main.go
binary: PrometheusAlert
ldflags: -s -w -X main.Version=${{.Version}} -X main.Revision={{.ShortCommit}} -X main.BuildDate={{.Date}} -X main.BuildUser=goreleaser
env:
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
goos:
- windows
goarch:
- amd64
# 在linux上交叉编译arm64 cgo需要arm64 gcc模块
#- id: build-arm
# main: main.go
# binary: PrometheusAlert
# ldflags: -s -w -X main.Version=${{.Version}} -X main.Revision={{.ShortCommit}} -X main.BuildDate={{.Date}} -X main.BuildUser=goreleaser
# env:
# - CC=aarch64-linux-gnu-gcc
# - CXX=aarch64-linux-gnu-g++
# goos:
# - linux
# goarch:
# - arm64
archives:
- id: archive-package
format: tar.gz
name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
wrap_in_directory: true
replacements:
linux: Linux
windows: Windows
386: i386
amd64: x86_64
arm64: ARM64
format_overrides:
- goos: windows
format: zip
files:
- conf/app-example.conf
- db/
- logs/
- static/
- views/
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Version }}_snapshot"