# .goreleaser.yml created for goreleaser version v1.16.1
# Documentation at http://goreleaser.com
before:
  hooks:
    # You may remove this if you don't use go modules.
    - go mod download
builds:
  - env:
      - CGO_ENABLED=0
    goos:
      - linux
      - windows
      - darwin
    goarch:
      - amd64
      - arm64
archives:
  - format_overrides:
      - goos: windows
        format: zip
checksum:
  name_template: 'checksums.txt'
snapshot:
  name_template: "dev-{{.Commit}}"
changelog:
  sort: asc
  filters:
    exclude:
      - '^docs:'
      - '^test:'
source:
  enabled: true
nfpms:
  - package_name: pg-back
    homepage: https://github.com/orgrim/pg_back/
    maintainer: Nicolas Thauvin <nico@orgrim.net>
    description: |
      pg_back uses pg_dumpall to dump roles and tablespaces, pg_dump to dump
      each selected database to a separate file. The custom format of pg_dump
      is used by default.
    license: PostgreSQL
    formats:
      - deb
      - rpm
    bindir: /usr/bin
    contents:
      - src: pg_back.conf
        dst: /etc/pg_back/pg_back.conf
        type: "config|noreplace"

      - src: contrib/systemd/pg_back@.service
        dst: /lib/systemd/system/pg_back@.service
        packager: deb

      - src: contrib/systemd/pg_back@.timer
        dst: /lib/systemd/system/pg_back@.timer
        packager: deb
    replaces:
      - pg_back
    overrides:
      deb:
        dependencies:
          - postgresql-client
      rpm:
        file_name_template: >-
          {{ .PackageName }}-{{ .Version }}-
          {{- if eq .Arch "amd64" }}x86_64
          {{- else }}{{ .Arch }}{{ end }}
        dependencies:
          - postgresql
    rpm:
      summary: pg_back dumps databases from PostgreSQL
      group: Applications/Databases
signs:
  - signature: "${artifact}.asc"
    args: ["-u", "nico@orgrim.net", "-o", "${signature}", "-a", "-b", "${artifact}"]
    artifacts: checksum
