From 6dc40cfa7f2bbe0bcb75dbc544b8f0dca42bc529 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 29 Apr 2024 15:21:46 +0800 Subject: [PATCH] chore: update build and linting configurations - Update CodeQL GitHub Actions from v2 to v3 in codeql.yml - Change goreleaser argument from `--rm-dist` to `--clean` in goreleaser.yml - Update golangci-lint GitHub Action from v3 to v5 in lint.yml - Update the Docker container for linting from golang:1.19-alpine to golang:1.22-alpine in lint.yml - Standardize quotes around `checksums.txt` in .goreleaser.yaml - Add changelog configuration with groups for features, bug fixes, enhancements, refactor, build process updates, documentation updates, and others in .goreleaser.yaml Signed-off-by: Bo-Yi Wu --- .github/workflows/codeql.yml | 4 +- .github/workflows/goreleaser.yml | 2 +- .github/workflows/lint.yml | 4 +- .goreleaser.yaml | 172 ++++++++++++++++++------------- 4 files changed, 103 insertions(+), 79 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3b324f1..f3ceec8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -42,7 +42,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -51,4 +51,4 @@ jobs: # queries: ./path/to/local/query, your-org/your-repo/queries@main - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 5dab80f..4be1814 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -27,6 +27,6 @@ jobs: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5dbd08e..c6c3653 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Setup golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v5 with: version: latest args: --verbose @@ -27,7 +27,7 @@ jobs: testing: runs-on: ubuntu-latest - container: golang:1.19-alpine + container: golang:1.22-alpine steps: - name: Checkout repository uses: actions/checkout@v4 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