version: 2
before:
  hooks:
  - go mod tidy

env:
  - PACKAGE_PATH=github.com/<user>/<repo>/cmd

builds:
- binary: "{{ .ProjectName }}"
  main: ./cmd/api
  goos:
  - darwin
  - linux
  - windows
  goarch:
  - amd64
  - arm64
  env:
  - CGO_ENABLED=0
  ldflags:
  - -s -w -X {{.Env.PACKAGE_PATH}}={{.Version}} 
release:
  prerelease: auto

universal_binaries:
- replace: true

archives:
  - name_template: >
      {{- .ProjectName }}_{{- .Version }}_{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64{{- else if eq .Arch "386" }}i386{{- else }}{{ .Arch }}{{ end }}{{- if .Arm }}v{{ .Arm }}{{ end -}}
    format_overrides:
      - goos: windows
        format: zip
    builds_info:
      group: root
      owner: root
    files:
      - README.md

checksum:
  name_template: 'checksums.txt'
