From 83c64d280a738019e89d6b030105c04e91960d9e Mon Sep 17 00:00:00 2001 From: appleboy Date: Sat, 18 May 2024 16:08:28 +0800 Subject: [PATCH] chore: standardize code style and add changelog configuration ### - Change single quotes to double quotes for `name_template` value - Add changelog configuration using GitHub - Define changelog groups for Features, Bug fixes, Enhancements, Refactor, Build process updates, Documentation updates, and Others Signed-off-by: appleboy ### --- .goreleaser.yaml | 172 +++++++++++++++++++++++++++-------------------- 1 file changed, 98 insertions(+), 74 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index f1c33be..180f8ff 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -3,78 +3,78 @@ before: - go mod tidy builds: -- env: - - CGO_ENABLED=0 - goos: - - darwin - - linux - - windows - - freebsd - goarch: - - amd64 - - arm - - arm64 - goarm: - - "5" - - "6" - - "7" - ignore: - - goos: darwin - goarch: arm - - goos: darwin - goarch: ppc64le - - goos: darwin - goarch: s390x - - goos: windows - goarch: ppc64le - - goos: windows - goarch: s390x - - goos: windows - goarch: arm - goarm: "5" - - goos: windows - goarch: arm - goarm: "6" - - goos: windows - goarch: arm - goarm: "7" - - goos: windows - goarch: arm64 - - goos: freebsd - goarch: ppc64le - - goos: freebsd - goarch: s390x - - goos: freebsd - goarch: arm - goarm: "5" - - goos: freebsd - goarch: arm - goarm: "6" - - goos: freebsd - goarch: arm - goarm: "7" - - goos: freebsd - goarch: arm64 - flags: - - -trimpath - ldflags: - - -s -w - - -X main.Version={{.Version}} - binary: >- - {{ .ProjectName }}- - {{- if .IsSnapshot }}{{ .Branch }}- - {{- else }}{{- .Version }}-{{ end }} - {{- .Os }}- - {{- if eq .Arch "amd64" }}amd64 - {{- else if eq .Arch "amd64_v1" }}amd64 - {{- else if eq .Arch "386" }}386 - {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}-{{ .Arm }}{{ end }} - no_unique_dist_dir: true - hooks: - post: - - cmd: xz -k -9 {{ .Path }} - dir: ./dist/ + - env: + - CGO_ENABLED=0 + goos: + - darwin + - linux + - windows + - freebsd + goarch: + - amd64 + - arm + - arm64 + goarm: + - "5" + - "6" + - "7" + ignore: + - goos: darwin + goarch: arm + - goos: darwin + goarch: ppc64le + - goos: darwin + goarch: s390x + - goos: windows + goarch: ppc64le + - goos: windows + goarch: s390x + - goos: windows + goarch: arm + goarm: "5" + - goos: windows + goarch: arm + goarm: "6" + - goos: windows + goarch: arm + goarm: "7" + - goos: windows + goarch: arm64 + - goos: freebsd + goarch: ppc64le + - goos: freebsd + goarch: s390x + - goos: freebsd + goarch: arm + goarm: "5" + - goos: freebsd + goarch: arm + goarm: "6" + - goos: freebsd + goarch: arm + goarm: "7" + - goos: freebsd + goarch: arm64 + flags: + - -trimpath + ldflags: + - -s -w + - -X main.Version={{.Version}} + binary: >- + {{ .ProjectName }}- + {{- if .IsSnapshot }}{{ .Branch }}- + {{- else }}{{- .Version }}-{{ end }} + {{- .Os }}- + {{- if eq .Arch "amd64" }}amd64 + {{- else if eq .Arch "amd64_v1" }}amd64 + {{- else if eq .Arch "386" }}386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}-{{ .Arm }}{{ end }} + no_unique_dist_dir: true + hooks: + post: + - cmd: xz -k -9 {{ .Path }} + dir: ./dist/ archives: - format: binary @@ -82,9 +82,9 @@ archives: allow_different_binary_count: true checksum: - name_template: 'checksums.txt' + name_template: "checksums.txt" extra_files: - - glob: ./**.xz + - glob: ./**.xz snapshot: name_template: "{{ incpatch .Version }}" @@ -97,3 +97,27 @@ release: # Templates: allowed extra_files: - 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