version: 2

project_name: hauler
before:
  hooks:
    - go mod tidy
    - go mod download
    - go fmt ./...
    - go vet ./...
    - go test ./... -cover -race -covermode=atomic -coverprofile=coverage.out

release:
  prerelease: auto
  make_latest: false

env:
  - vpkg=hauler.dev/go/hauler/internal/version
  - cosign_version=v2.2.3+carbide.3

builds:
  - dir: ./cmd/hauler/.
    goos:
      - linux
      - darwin
      - windows
    goarch:
      - amd64
      - arm64
    ldflags:
      - -s -w -X {{ .Env.vpkg }}.gitVersion={{ .Version }} -X {{ .Env.vpkg }}.gitCommit={{ .ShortCommit }} -X {{ .Env.vpkg }}.gitTreeState={{if .IsGitDirty}}dirty{{else}}clean{{end}} -X {{ .Env.vpkg }}.buildDate={{ .Date }}
    env:
      - CGO_ENABLED=0
      - GOEXPERIMENT=boringcrypto

universal_binaries:
  - replace: false

changelog:
  disable: false
  use: git

homebrew_casks:
  - name: hauler
    repository:
      owner: hauler-dev
      name: homebrew-tap
      token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
    description: "Hauler: Airgap Swiss Army Knife"

dockers_v2:
  - id: hauler
    dockerfile: Dockerfile
    flags:
      - "--target=release"
    images:
      - docker.io/hauler/hauler
      - ghcr.io/hauler-dev/hauler
    tags:
      - "{{ .Version }}"
    platforms:
      - linux/amd64
      - linux/arm64
    labels:
      "classification": "UNCLASSIFIED"
      "org.opencontainers.image.created": "{{.Date}}"
      "org.opencontainers.image.description": "Hauler: Airgap Swiss Army Knife"
      "org.opencontainers.image.name": "{{.ProjectName}}-debug"
      "org.opencontainers.image.revision": "{{.FullCommit}}"
      "org.opencontainers.image.source": "{{.GitURL}}"
      "org.opencontainers.image.version": "{{.Version}}"

  - id: hauler-debug
    dockerfile: Dockerfile
    flags:
      - "--target=debug"
    images:
      - docker.io/hauler/hauler-debug
      - ghcr.io/hauler-dev/hauler-debug
    tags:
      - "{{ .Version }}"
    platforms:
      - linux/amd64
      - linux/arm64
    labels:
      "classification": "UNCLASSIFIED"
      "org.opencontainers.image.created": "{{.Date}}"
      "org.opencontainers.image.description": "Hauler: Airgap Swiss Army Knife"
      "org.opencontainers.image.name": "{{.ProjectName}}-debug"
      "org.opencontainers.image.revision": "{{.FullCommit}}"
      "org.opencontainers.image.source": "{{.GitURL}}"
      "org.opencontainers.image.version": "{{.Version}}"