release:
  prerelease: auto

before:
  hooks:
    - go mod download

builds:
  - id: linux
    main: ./cmd/okctl
    binary: okctl
    flags:
      - -tags
      - netgo release
      - -trimpath
    env:
      - CGO_ENABLED=1
    ldflags:
      - -s
      - -w
      - -X github.com/oslokommune/okctl/pkg/version.ShortCommit={{.ShortCommit}}
      - -X github.com/oslokommune/okctl/pkg/version.Version={{.Version}}
      - -X github.com/oslokommune/okctl/pkg/version.BuildDate={{.Date}}
    goos:
      - linux
    goarch:
      - amd64
  - id: darwin
    main: ./cmd/okctl
    binary: okctl
    flags:
      - -tags
      - netgo release
      - -trimpath
    env:
      - CGO_ENABLED=1
      - CC=o64-clang
      - CXX=o64-clang++
    ldflags:
      - -s
      - -w
      - -X github.com/oslokommune/okctl/pkg/version.ShortCommit={{.ShortCommit}}
      - -X github.com/oslokommune/okctl/pkg/version.Version={{.Version}}
      - -X github.com/oslokommune/okctl/pkg/version.BuildDate={{.Date}}
    goos:
      - darwin
    goarch:
      - amd64

archives:
  - replacements:
      darwin: Darwin
      linux: Linux
    id: default
    builds:
      - linux
      - darwin
    name_template: "okctl_{{ .Os }}_{{ .Arch }}"
    format: tar.gz
    files:
      - none*

checksum:
  name_template: 'okctl_checksums.txt'