project_name: troubleshoot
builds:
  - id: preflight
    # NOTE: if you add any additional goos/goarch values, ensure you update ../.github/workflows/build-test-deploy.yaml
    # specifically the matrix values for goreleaser-test
    goos:
      - linux
      - darwin
      - windows
    goarch:
      - amd64
      - arm
      - arm64
      - riscv64
    ignore:
      - goos: windows
        goarch: arm
    env:
      - CGO_ENABLED=0
    main: cmd/preflight/main.go
    ldflags: -s -w
      -X github.com/replicatedhq/troubleshoot/pkg/version.version={{.Version}}
      -X github.com/replicatedhq/troubleshoot/pkg/version.gitSHA={{.Commit}}
      -X github.com/replicatedhq/troubleshoot/pkg/version.buildTime={{.Date}}
      -extldflags "-static"
    flags: -tags netgo -tags containers_image_ostree_stub -tags exclude_graphdriver_devicemapper -tags exclude_graphdriver_btrfs -tags containers_image_openpgp -installsuffix netgo
    binary: preflight
    hooks: {}
  - id: support-bundle
    goos:
      - linux
      - darwin
      - windows
    goarch:
      - amd64
      - arm
      - arm64
      - riscv64
    ignore:
      - goos: windows
        goarch: arm
    env:
      - CGO_ENABLED=0
    main: cmd/troubleshoot/main.go
    ldflags: -s -w
      -X github.com/replicatedhq/troubleshoot/pkg/version.version={{.Version}}
      -X github.com/replicatedhq/troubleshoot/pkg/version.gitSHA={{.Commit}}
      -X github.com/replicatedhq/troubleshoot/pkg/version.buildTime={{.Date}}
      -extldflags "-static"
    flags: -tags netgo -tags containers_image_ostree_stub -tags exclude_graphdriver_devicemapper -tags exclude_graphdriver_btrfs -tags containers_image_openpgp -installsuffix netgo
    binary: support-bundle
    hooks: {}
  - id: collect
    goos:
      - linux
      - darwin
      - windows
    goarch:
      - amd64
      - arm
      - arm64
      - riscv64
    ignore:
      - goos: windows
        goarch: arm
    env:
      - CGO_ENABLED=0
    main: cmd/collect/main.go
    ldflags: -s -w
      -X github.com/replicatedhq/troubleshoot/pkg/version.version={{.Version}}
      -X github.com/replicatedhq/troubleshoot/pkg/version.gitSHA={{.Commit}}
      -X github.com/replicatedhq/troubleshoot/pkg/version.buildTime={{.Date}}
      -extldflags "-static"
    flags: -tags netgo -tags containers_image_ostree_stub -tags exclude_graphdriver_devicemapper -tags exclude_graphdriver_btrfs -tags containers_image_openpgp -installsuffix netgo
    binary: collect
    hooks: {}
archives:
  - id: preflight
    builds:
      - preflight
    format: tar.gz
    format_overrides:
      - goos: windows
        format: zip
    name_template: 'preflight_{{ .Os }}_{{ .Arch }}'
    files:
      - licence*
      - LICENCE*
      - license*
      - LICENSE*
      - readme*
      - README*
      - changelog*
      - CHANGELOG*
      - src: 'sbom/assets/*'
        dst: .
        strip_parent: true  # this is needed to make up for the way unzips work in krew v0.4.1
  - id: support-bundle
    builds:
      - support-bundle
    format: tar.gz
    format_overrides:
      - goos: windows
        format: zip
    name_template: 'support-bundle_{{ .Os }}_{{ .Arch }}'
    files:
      - licence*
      - LICENCE*
      - license*
      - LICENSE*
      - readme*
      - README*
      - changelog*
      - CHANGELOG*
      - src: 'sbom/assets/*'
        dst: .
        strip_parent: true # this is needed to make up for the way unzips work in krew v0.4.1
  - id: collect
    builds:
      - collect
    format: tar.gz
    format_overrides:
      - goos: windows
        format: zip
    name_template: 'collect_{{ .Os }}_{{ .Arch }}'
    files:
      - licence*
      - LICENCE*
      - license*
      - LICENSE*
      - readme*
      - README*
      - changelog*
      - CHANGELOG*
      - src: 'sbom/assets/*'
        dst: .
        strip_parent: true # this is needed to make up for the way unzips work in krew v0.4.1
dockers:
  - dockerfile: ./deploy/Dockerfile.troubleshoot
    image_templates:
      - "replicated/troubleshoot:latest"
      - "replicated/troubleshoot:{{ .Major }}"
      - "replicated/troubleshoot:{{ .Major }}.{{ .Minor }}"
      - "replicated/troubleshoot:{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
    ids:
      - support-bundle
      - preflight
      - collect
  - dockerfile: ./deploy/Dockerfile.troubleshoot
    image_templates:
      - "replicated/preflight:latest"
      - "replicated/preflight:{{ .Major }}"
      - "replicated/preflight:{{ .Major }}.{{ .Minor }}"
      - "replicated/preflight:{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
    ids:
      - support-bundle
      - preflight
      - collect
