diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 2f6e471..ae284fa 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -19,7 +19,8 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: "^1" + go-version-file: go.mod + check-latest: true - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..180f8ff --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,123 @@ +before: + hooks: + - 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/ + +archives: + - format: binary + name_template: "{{ .Binary }}" + allow_different_binary_count: true + +checksum: + name_template: "checksums.txt" + extra_files: + - glob: ./**.xz + +snapshot: + name_template: "{{ incpatch .Version }}" + +release: + # You can add extra pre-existing files to the release. + # The filename on the release will be the last part of the path (base). + # If another file with the same name exists, the last one found will be used. + # + # 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