.goreleaser.yaml

# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2

project_name: ployz

builds:
  - id: ployz-linux-amd64
    builder: rust
    binary: ployz
    skip: '{{ and (ne (index .Env "RELEASE_ID") "") (ne (index .Env "RELEASE_ID") "ployz-linux-amd64") }}'
    targets:
      - x86_64-unknown-linux-musl
    flags: &ployz-flags
      - --release
      - --locked
      - --package=ployz
      - --bin=ployz

  - id: ployz-linux-arm64
    builder: rust
    binary: ployz
    skip: '{{ and (ne (index .Env "RELEASE_ID") "") (ne (index .Env "RELEASE_ID") "ployz-linux-arm64") }}'
    targets:
      - aarch64-unknown-linux-musl
    flags: *ployz-flags

  # zig 0.13 segfaults linking the CLI's Apple targets, so the macOS runner links
  # them with its own toolchain; zig stays only for the musl targets.
  - id: ployz-darwin
    builder: rust
    command: build
    binary: ployz
    skip: '{{ and (ne (index .Env "RELEASE_ID") "") (ne (index .Env "RELEASE_ID") "ployz-darwin") }}'
    targets:
      - x86_64-apple-darwin
      - aarch64-apple-darwin
    flags: *ployz-flags

  - id: ployzd-linux-amd64
    builder: rust
    binary: ployzd
    skip: '{{ and (ne (index .Env "RELEASE_ID") "") (ne (index .Env "RELEASE_ID") "ployzd-linux-amd64") }}'
    targets:
      - x86_64-unknown-linux-musl
    flags: &ployzd-flags
      - --release
      - --locked
      - --package=ployzd
      - --bin=ployzd
    hooks: &ployzd-hooks
      pre:
        - cargo zigbuild --release --locked --package ployz-testkit --bin sqlite-probe --target {{ .Target }}

  - id: ployzd-linux-arm64
    builder: rust
    binary: ployzd
    skip: '{{ and (ne (index .Env "RELEASE_ID") "") (ne (index .Env "RELEASE_ID") "ployzd-linux-arm64") }}'
    targets:
      - aarch64-unknown-linux-musl
    flags: *ployzd-flags
    hooks: *ployzd-hooks

  - id: ployz-relay-linux-amd64
    builder: rust
    binary: ployz-relay
    skip: '{{ and (ne (index .Env "RELEASE_ID") "") (ne (index .Env "RELEASE_ID") "ployz-relay-linux-amd64") }}'
    targets:
      - x86_64-unknown-linux-musl
    flags: &ployz-relay-flags
      - --release
      - --locked
      - --package=ployz-relay
      - --bin=ployz-relay

  - id: ployz-relay-linux-arm64
    builder: rust
    binary: ployz-relay
    skip: '{{ and (ne (index .Env "RELEASE_ID") "") (ne (index .Env "RELEASE_ID") "ployz-relay-linux-arm64") }}'
    targets:
      - aarch64-unknown-linux-musl
    flags: *ployz-relay-flags

archives:
  - id: ployz
    builds: [ployz-linux-amd64, ployz-linux-arm64, ployz-darwin]
    format: tar.gz
    name_template: >-
      ployz_
      {{- if eq .Os "darwin" }}macos
      {{- else }}{{ .Os }}{{ end }}_
      {{- .Arch }}
    builds_info:
      mode: 0755
    files:
      - none*

  - id: ployzd
    builds: [ployzd-linux-amd64, ployzd-linux-arm64]
    format: tar.gz
    name_template: "ployzd_{{ .Os }}_{{ .Arch }}"
    builds_info:
      mode: 0755
    files:
      - src: scripts/uninstall.sh
        dst: ployz-uninstall
        info:
          mode: 0755

  - id: ployz-relay
    builds: [ployz-relay-linux-amd64, ployz-relay-linux-arm64]
    format: tar.gz
    name_template: "ployz-relay_{{ .Os }}_{{ .Arch }}"
    builds_info:
      mode: 0755
    files:
      - none*

checksum:
  name_template: checksums.txt
  ids: [ployz]

brews:
  - name: ployz
    description: Ployz CLI
    homepage: https://github.com/getployz/ployz2
    ids: [ployz]
    install: bin.install "ployz"
    caveats: |
      This formula replaces the older getployz/ployz implementation as a clean break
      with manual transition, not an in-place compatibility promise.
    skip_upload: true
    repository:
      owner: getployz
      name: homebrew-ployz

changelog:
  disable: true