# GoReleaser v2 Configuration for DeBros Network
# Builds and releases orama (CLI) and orama-node binaries.
# Publishes to: GitHub Releases, Homebrew (stable only), and apt (.deb packages).

version: 2
project_name: orama-network

env:
  - GO111MODULE=on

before:
  hooks:
    - go -C core mod tidy

builds:
  # orama CLI binary
  - id: orama
    dir: core
    main: ./cmd/cli
    binary: orama
    goos:
      - linux
      - darwin
    goarch:
      - amd64
      - arm64
    ldflags:
      - -s -w
      - -X main.version={{.Version}}
      - -X main.commit={{.ShortCommit}}
      - -X main.date={{.Date}}
    mod_timestamp: "{{ .CommitTimestamp }}"

  # orama-node binary (Linux only for apt)
  - id: orama-node
    dir: core
    main: ./cmd/node
    binary: orama-node
    goos:
      - linux
    goarch:
      - amd64
      - arm64
    ldflags:
      - -s -w
      - -X main.version={{.Version}}
      - -X main.commit={{.ShortCommit}}
      - -X main.date={{.Date}}
    mod_timestamp: "{{ .CommitTimestamp }}"

archives:
  # Tar.gz archives for orama CLI
  - id: orama-archives
    ids:
      - orama
    formats: [tar.gz]
    name_template: "orama_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
    files:
      - README.md
      - LICENSE

  # Tar.gz archives for orama-node
  - id: orama-node-archives
    ids:
      - orama-node
    formats: [tar.gz]
    name_template: "orama-node_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
    files:
      - README.md
      - LICENSE

# Debian packages for apt
nfpms:
  # orama CLI .deb package
  - id: orama-deb
    package_name: orama
    ids:
      - orama
    vendor: DeBros
    homepage: https://github.com/DeBrosDAO/orama
    maintainer: DeBros <dev@debros.io>
    description: CLI tool for the Orama decentralized network
    license: MIT
    formats:
      - deb
    bindir: /usr/bin
    section: utils
    priority: optional
    contents:
      - src: ./README.md
        dst: /usr/share/doc/orama/README.md
    deb:
      lintian_overrides:
        - statically-linked-binary

  # orama-node .deb package
  - id: orama-node-deb
    package_name: orama-node
    ids:
      - orama-node
    vendor: DeBros
    homepage: https://github.com/DeBrosDAO/orama
    maintainer: DeBros <dev@debros.io>
    description: Node daemon for the Orama decentralized network
    license: MIT
    formats:
      - deb
    bindir: /usr/bin
    section: net
    priority: optional
    contents:
      - src: ./README.md
        dst: /usr/share/doc/orama-node/README.md
    deb:
      lintian_overrides:
        - statically-linked-binary

# Homebrew tap for macOS (orama CLI only).
# Stable releases only — prereleases (nightly) are skipped so we don't
# pollute the tap or fight a 401 on a missing HOMEBREW_TAP_TOKEN.
brews:
  - name: orama
    ids:
      - orama-archives
    repository:
      owner: DeBrosDAO
      name: homebrew-tap
      token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
    directory: Formula
    homepage: https://github.com/DeBrosDAO/orama
    description: CLI tool for the Orama decentralized network
    license: MIT
    skip_upload: '{{ if .Prerelease }}true{{ else }}false{{ end }}'
    install: |
      bin.install "orama"
    test: |
      system "#{bin}/orama", "--version"

checksum:
  name_template: "checksums.txt"
  algorithm: sha256

snapshot:
  version_template: "{{ incpatch .Version }}-next"

changelog:
  sort: asc
  abbrev: -1
  filters:
    exclude:
      - "^docs:"
      - "^test:"
      - "^chore:"
      - "^ci:"
      - Merge pull request
      - Merge branch

release:
  github:
    owner: DeBrosDAO
    name: orama
  draft: false
  prerelease: auto
  name_template: "Release {{.Version}}"
