chore: standardize code style and enhance changelog configuration

- Change single quotes to double quotes for `name_template`
- Add changelog configuration with GitHub integration
- Define changelog groups for Features, Bug fixes, Enhancements, Refactor, Build process updates, Documentation updates, and Others

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2024-07-19 07:46:51 +08:00
parent 79beba5443
commit 7468610684
No known key found for this signature in database
2 changed files with 99 additions and 75 deletions

2
.gitignore vendored
View File

@ -29,4 +29,4 @@ dist
.cover .cover
release release
bin bin
.idea .idea

View File

@ -3,78 +3,78 @@ before:
- go mod tidy - go mod tidy
builds: builds:
- env: - env:
- CGO_ENABLED=0 - CGO_ENABLED=0
goos: goos:
- darwin - darwin
- linux - linux
- windows - windows
- freebsd - freebsd
goarch: goarch:
- amd64 - amd64
- arm - arm
- arm64 - arm64
goarm: goarm:
- "5" - "5"
- "6" - "6"
- "7" - "7"
ignore: ignore:
- goos: darwin - goos: darwin
goarch: arm goarch: arm
- goos: darwin - goos: darwin
goarch: ppc64le goarch: ppc64le
- goos: darwin - goos: darwin
goarch: s390x goarch: s390x
- goos: windows - goos: windows
goarch: ppc64le goarch: ppc64le
- goos: windows - goos: windows
goarch: s390x goarch: s390x
- goos: windows - goos: windows
goarch: arm goarch: arm
goarm: "5" goarm: "5"
- goos: windows - goos: windows
goarch: arm goarch: arm
goarm: "6" goarm: "6"
- goos: windows - goos: windows
goarch: arm goarch: arm
goarm: "7" goarm: "7"
- goos: windows - goos: windows
goarch: arm64 goarch: arm64
- goos: freebsd - goos: freebsd
goarch: ppc64le goarch: ppc64le
- goos: freebsd - goos: freebsd
goarch: s390x goarch: s390x
- goos: freebsd - goos: freebsd
goarch: arm goarch: arm
goarm: "5" goarm: "5"
- goos: freebsd - goos: freebsd
goarch: arm goarch: arm
goarm: "6" goarm: "6"
- goos: freebsd - goos: freebsd
goarch: arm goarch: arm
goarm: "7" goarm: "7"
- goos: freebsd - goos: freebsd
goarch: arm64 goarch: arm64
flags: flags:
- -trimpath - -trimpath
ldflags: ldflags:
- -s -w - -s -w
- -X main.Version={{.Version}} - -X main.Version={{.Version}}
binary: >- binary: >-
{{ .ProjectName }}- {{ .ProjectName }}-
{{- if .IsSnapshot }}{{ .Branch }}- {{- if .IsSnapshot }}{{ .Branch }}-
{{- else }}{{- .Version }}-{{ end }} {{- else }}{{- .Version }}-{{ end }}
{{- .Os }}- {{- .Os }}-
{{- if eq .Arch "amd64" }}amd64 {{- if eq .Arch "amd64" }}amd64
{{- else if eq .Arch "amd64_v1" }}amd64 {{- else if eq .Arch "amd64_v1" }}amd64
{{- else if eq .Arch "386" }}386 {{- else if eq .Arch "386" }}386
{{- else }}{{ .Arch }}{{ end }} {{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}-{{ .Arm }}{{ end }} {{- if .Arm }}-{{ .Arm }}{{ end }}
no_unique_dist_dir: true no_unique_dist_dir: true
hooks: hooks:
post: post:
- cmd: xz -k -9 {{ .Path }} - cmd: xz -k -9 {{ .Path }}
dir: ./dist/ dir: ./dist/
archives: archives:
- format: binary - format: binary
@ -82,9 +82,9 @@ archives:
allow_different_binary_count: true allow_different_binary_count: true
checksum: checksum:
name_template: 'checksums.txt' name_template: "checksums.txt"
extra_files: extra_files:
- glob: ./**.xz - glob: ./**.xz
snapshot: snapshot:
name_template: "{{ incpatch .Version }}" name_template: "{{ incpatch .Version }}"
@ -97,3 +97,27 @@ release:
# Templates: allowed # Templates: allowed
extra_files: extra_files:
- glob: ./**.xz - glob: ./**.xz
changelog:
use: github
groups:
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: "Enhancements"
regexp: "^.*chore[(\\w)]*:+.*$"
order: 2
- title: "Refactor"
regexp: "^.*refactor[(\\w)]*:+.*$"
order: 3
- title: "Build process updates"
regexp: ^.*?(build|ci)(\(.+\))??!?:.+$
order: 4
- title: "Documentation updates"
regexp: ^.*?docs?(\(.+\))??!?:.+$
order: 4
- title: Others
order: 999