# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
version: 2

before:
  hooks:
    # `go mod tidy` fails on public CI runners because internal/diff/sandbox.go
    # (//go:build sandbox) imports the closed-source pkg/sandbox/. tidy evaluates
    # all build tags. Use `go mod download` which only fetches what go.mod requires.
    - go mod download
    - ./hack/make/completions
    - ./hack/make/manpages

builds:
  - id: darwin_arm64_extras
    main: ./cmd/ipsw
    binary: ipsw
    env:
      - CGO_ENABLED=1
      - CGO_LDFLAGS=-L/opt/homebrew/lib
      - CGO_CFLAGS=-I/opt/homebrew/include
      - PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig
    goos:
      - darwin
    goarch:
      - arm64
    tags:
      - libusb
      - unicorn
    mod_timestamp: "{{ .CommitTimestamp }}"
    flags:
      - -trimpath
    ldflags:
      - -s -w
      - -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppVersion={{.Version}}
      - -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppBuildCommit={{.Commit}}

archives:
  - id: darwin_arm64_extras_archive
    builds:
      - darwin_arm64_extras
    name_template: "{{ .ProjectName }}_{{ .Version }}_macOS_arm64_extras"
    replacements:
      darwin: macOS
      ios: iOS
    format_overrides:
      - goos: windows
        format: zip
    files:
      - README.md
      - LICENSE
      - completions/*
      - manpages/*
    wrap_in_directory: true

checksum:
  name_template: "checksums.darwin_arm64_extras.txt"

sboms:
  - artifacts: archive
