project_name: scaffold
before:
  hooks:
    - go mod download
    - go generate .
builds:
  - env:
      - CGO_ENABLED=0
    goarch:
      - amd64
      - arm
      - arm64
    goarm:
      - 6
      - 7
archives:
  - format: tar.gz
    # this name template makes the OS and Arch compatible with the results of uname.
    name_template: >-
      {{ .ProjectName }}_
      {{- title .Os }}_
      {{- if eq .Arch "amd64" }}x86_64
      {{- else if eq .Arch "386" }}i386
      {{- else }}{{ .Arch }}{{ end }}
      {{- if .Arm }}v{{ .Arm }}{{ end }}
    # use zip for windows archives
    format_overrides:
      - goos: windows
        format: zip
checksum:
  name_template: "checksums.txt"
snapshot:
  name_template: "{{ incpatch .Version }}-next"
changelog:
  sort: asc
  filters:
    exclude:
      - "^:pencil:"
brews:
  - tap:
      owner: clevyr
      name: homebrew-tap
    folder: Formula
    install: |
      bin.install "{{ .ProjectName }}"
      output = Utils.safe_popen_read("#{bin}/{{ .ProjectName }}", "completion", "bash")
      (bash_completion/"{{ .ProjectName }}").write output
      output = Utils.safe_popen_read("#{bin}/{{ .ProjectName }}", "completion", "zsh")
      (zsh_completion/"_{{ .ProjectName }}").write output
dockers:
  - image_templates:
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-amd64
    use: buildx
    dockerfile: Dockerfile.goreleaser
    build_flag_templates:
      - "--platform=linux/amd64"
  - image_templates:
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv6
    use: buildx
    goarch: arm
    goarm: 6
    dockerfile: Dockerfile.goreleaser
    build_flag_templates:
      - "--platform=linux/arm/v7"
  - image_templates:
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv7
    use: buildx
    goarch: arm
    goarm: 7
    dockerfile: Dockerfile.goreleaser
    build_flag_templates:
      - "--platform=linux/arm/v8"
  - image_templates:
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-arm64v8
    use: buildx
    goarch: arm64
    dockerfile: Dockerfile.goreleaser
    build_flag_templates:
      - "--platform=linux/arm64/v8"
docker_manifests:
  - name_template: ghcr.io/clevyr/{{ .ProjectName }}:latest
    image_templates:
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-amd64
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv6
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv7
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-arm64v8
  - name_template: ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}
    image_templates:
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-amd64
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv6
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv7
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-arm64v8
  - name_template: ghcr.io/clevyr/{{ .ProjectName }}:{{ .Major }}
    image_templates:
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-amd64
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv6
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv7
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-arm64v8
  - name_template: ghcr.io/clevyr/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}
    image_templates:
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-amd64
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv6
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-armv7
      - ghcr.io/clevyr/{{ .ProjectName }}:{{ .Version }}-arm64v8
announce:
  slack:
    enabled: true
