version: 2
project_name: cameradar
dist: dist/cameradar

env:
  - GO111MODULE=on
before:
  hooks:
    - go mod download

builds:
  - binary: cameradar
    main: ./cmd/cameradar
    env:
      - CGO_ENABLED=0
    goos:
      - windows
      - darwin
      - linux
    goarch:
      - amd64
      - 386
      - arm
      - arm64
    goarm:
      - 6
      - 7

    ignore:
      - goos: darwin
        goarch: 386

changelog:
  disable: true

checksum:
  name_template: "{{ .ProjectName }}_checksums.txt"

archives:
  - name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm}}v{{ .Arm }}{{ end }}"
    formats:
      - tar.gz
    format_overrides:
      - goos: windows
        format: zip

dockers:
  - image_templates:
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-amd64"
      - "ullaakut/{{ .ProjectName }}:latest-amd64"
    dockerfile: Dockerfile
    use: buildx
    goos: linux
    goarch: amd64
  - image_templates:
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-386"
      - "ullaakut/{{ .ProjectName }}:latest-386"
    dockerfile: Dockerfile
    use: buildx
    goos: linux
    goarch: 386
  - image_templates:
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-armv6"
      - "ullaakut/{{ .ProjectName }}:latest-armv6"
    dockerfile: Dockerfile
    use: buildx
    goos: linux
    goarch: arm
    goarm: 6
  - image_templates:
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-armv7"
      - "ullaakut/{{ .ProjectName }}:latest-armv7"
    dockerfile: Dockerfile
    use: buildx
    goos: linux
    goarch: arm
    goarm: 7
  - image_templates:
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-arm64"
      - "ullaakut/{{ .ProjectName }}:latest-arm64"
    dockerfile: Dockerfile
    use: buildx
    goos: linux
    goarch: arm64

docker_manifests:
  - name_template: "ullaakut/{{ .ProjectName }}:v{{ .Version }}"
    image_templates:
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-amd64"
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-386"
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-armv6"
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-armv7"
      - "ullaakut/{{ .ProjectName }}:v{{ .Version }}-arm64"
  - name_template: "ullaakut/{{ .ProjectName }}:latest"
    image_templates:
      - "ullaakut/{{ .ProjectName }}:latest-amd64"
      - "ullaakut/{{ .ProjectName }}:latest-386"
      - "ullaakut/{{ .ProjectName }}:latest-armv6"
      - "ullaakut/{{ .ProjectName }}:latest-armv7"
      - "ullaakut/{{ .ProjectName }}:latest-arm64"