goreleaser 配置文件

goreleaser 可帮助我们快速构建与发布 Go 应用。


goreleaser 可指定不同的 main 函数来异步构建多个任务,下面是详细的配置文件:

# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
# https://goreleaser.com/customization/build/?h=binary
before:
  hooks:
    # You may remove this if you don't use go modules.
    - go mod tidy
    # you may remove this if you don't need go generate
    - go generate ./...
builds:
#  - env:
#      - CGO_ENABLED=0
  - main: ./main.go
    id: "FetchGithubIP"
    binary: "FetchGithubIP"
    goos:
      - darwin
      - linux
      - freebsd
    goarch:
      - amd64
      - 386
      - arm
      - arm64
    goarm:
      - 6
      - 7
  - main: ./main-windows.go
    id: "FetchGithubIP-windows"
    binary: "FetchGithubIP-windows"
    goos:
      - windows
    goarch:
      - amd64
      - 386
      - arm
      - arm64
    goarm:
      - 6
      - 7
archives:
  - replacements:
      darwin: MacOS
      linux: Linux
      windows: Windows
      freebsd: Freebsd
      386: i386
      amd64: x86_64
    format_overrides:
      - goos: windows
        format: zip
checksum:
  name_template: 'checksums.txt'
snapshot:
  name_template: "{{ incpatch .Version }}-next"

changelog:
  sort: asc
  filters:
    exclude:
      - '^docs:'
      - '^test:'
上次更新:
贡献者: iEchoxu