---
before:
  hooks:
    - go mod tidy -compat=1.19

release:
  prerelease: auto

builds:
  - id: darwin-amd64
    main: ./cmd/headscale/headscale.go
    mod_timestamp: "{{ .CommitTimestamp }}"
    env:
      - CGO_ENABLED=0
    goos:
      - darwin
    goarch:
      - amd64
    flags:
      - -mod=readonly
    ldflags:
      - -s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=v{{.Version}}
    tags:
      - ts2019

  - id: darwin-arm64
    main: ./cmd/headscale/headscale.go
    mod_timestamp: "{{ .CommitTimestamp }}"
    env:
      - CGO_ENABLED=0
    goos:
      - darwin
    goarch:
      - arm64
    flags:
      - -mod=readonly
    ldflags:
      - -s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=v{{.Version}}
    tags:
      - ts2019

  - id: linux-amd64
    mod_timestamp: "{{ .CommitTimestamp }}"
    env:
      - CGO_ENABLED=0
    goos:
      - linux
    goarch:
      - amd64
    main: ./cmd/headscale/headscale.go
    ldflags:
      - -s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=v{{.Version}}
    tags:
      - ts2019

  - id: linux-arm64
    mod_timestamp: "{{ .CommitTimestamp }}"
    env:
      - CGO_ENABLED=0
    goos:
      - linux
    goarch:
      - arm64
    main: ./cmd/headscale/headscale.go
    ldflags:
      - -s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=v{{.Version}}
    tags:
      - ts2019

archives:
  - id: golang-cross
    builds:
      - darwin-amd64
      - darwin-arm64
      - linux-amd64
      - linux-arm64
    name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
    format: binary

checksum:
  name_template: "checksums.txt"
snapshot:
  name_template: "{{ .Tag }}-next"
changelog:
  sort: asc
  filters:
    exclude:
      - "^docs:"
      - "^test:"