version: 2 before: hooks: - go mod tidy builds: - id: default env: - CGO_ENABLED=0 goos: - windows - linux - darwin - freebsd goarch: # - 386 - amd64 # - arm - arm64 flags: - -trimpath ldflags: - -s -w hooks: pre: | go generate ./... upx: - ids: [ default ] enabled: true goos: ["windows", "linux"] goarch: ["amd64", "386"] compress: best # lzma: true # brute: true archives: - format: binary # format: tar.gz # 默认情况下,归档文件的格式 # format_overrides: # 根据目标操作系统覆盖默认的归档格式 # - goos: windows # format: zip allow_different_binary_count: true # 允许不同平台生成不同数量的二进制文件,避免 GoReleaser 报错 # name_template: >- # {{- .ProjectName }} # {{- if eq .Os "windows"}}_windows # {{- else if eq .Os "linux"}}_linux # {{- else if eq .Os "darwin"}}_darwin # {{- else }}_{{ .Os }}{{ end }} # {{- if eq .Arch "amd64" }}_amd64 # {{- else if eq .Arch "386" }}_386 # {{- else if eq .Arch "arm64" }}_arm64 # {{- else }}_{{ .Arch }}{{ end }} # {{- if .Arm }}v{{ .Arm }}{{ end -}} name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" # name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' # files: # - LICENSE* # - README* # - CHANGELOG* checksum: name_template: 'checksums.txt' snapshot: name_template: "{{ incpatch .Version }}-next" changelog: sort: asc filters: exclude: - '^docs:' - '^test:' - "^*.md" - "^*.ya?ml"