# GoReleaser configuration for Gonzo
# https://goreleaser.com

version: 2

project_name: gonzo

before:
  hooks:
    - go mod tidy
    - go mod download

builds:
  - id: gonzo
    main: ./cmd/gonzo
    binary: gonzo
    env:
      - CGO_ENABLED=0
    goos:
      - linux
      - darwin
      - windows
    goarch:
      - amd64
      - arm64
    ignore:
      - goos: windows
        goarch: arm64
    ldflags:
      - -s -w
      - -X main.version={{.Version}}
      - -X main.commit={{.ShortCommit}}
      - -X main.buildTime={{.Date}}
      - -X main.goVersion={{.Env.GO_VERSION}}
    flags:
      - -trimpath

archives:
  - id: default
    name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
    format_overrides:
      - goos: windows
        format: zip
    files:
      - LICENSE*
      - README*

checksum:
  name_template: 'checksums.txt'

snapshot:
  version_template: "{{ .Tag }}-next"

changelog:
  use: github
  sort: asc
  filters:
    exclude:
      - '^docs:'
      - '^test:'
      - '^chore:'
      - '^ci:'
      - Merge pull request
      - Merge branch

# Homebrew tap configuration
brews:
  - name: gonzo
    repository:
      owner: control-theory
      name: homebrew-gonzo
      branch: main
      # Use a separate token for tap access
      token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
    # Place formula in the Formula directory
    directory: Formula
    homepage: "https://github.com/control-theory/gonzo"
    description: "Gonzo! The Go based TUI log analysis tool"
    license: "MIT"
    install: |
      bin.install "gonzo"
    test: |
      system "#{bin}/gonzo", "--version"