# .goreleaser-release.yaml
#
# The GoReleaser configuration for rgw Defacto2 server.
#
# This goreleaser file is intended for the included docker-compose.yml file
# to generate a release build of the server for Linux.
#
# The configuration documentation is at https://goreleaser.com.
#
# To test any modifications to this configuration:
# $ goreleaser check
# $ goreleaser release --clean --snapshot
# $ goreleaser build --clean --snapshot
#
project_name: df2-server
before:
  hooks:
    # You may remove this if you don't use go modules.
    - go mod tidy
    # you may remove this if you don't need go generate.
    # go generate breaks github actions.
    #- go generate ./...
builds:
  - id: defacto2-app
    env:
      - CGO_ENABLED=0
    ldflags:
      - -X 'main.LocalMode=true'
    # keep the number of targets to a minimum to improve the build time.
    targets:
      - darwin_amd64
      - darwin_arm64
      - linux_amd64
      - linux_arm64
      - windows_amd64
  - id: server
    env:
      - CGO_ENABLED=0
    targets:
      - linux_amd64
universal_binaries:
  - replace: true
    ids: ["defacto2-app"]
    name_template: >-
      {{ tolower .ProjectName }}
archives:
  - format: zip
    name_template: >-
      {{- if eq .Os "darwin" }}{{ tolower .ProjectName }}_{{ .Version }}_macos{{else -}}
      {{ tolower .ProjectName }}_{{ .Version }}_{{- tolower .Os }}{{ end }}
    files:
      - src: public/text/defacto2.txt
        strip_parent: true
checksum:
  name_template: "checksums.txt"
snapshot:
  name_template: "{{ incpatch .Version }}-next"
changelog:
  sort: asc
  filters:
    exclude:
      - "^docs:"
      - "^test:"
      - "^tmp:"
      - ".env.local"
      - ".env"
nfpms:
  - id: deb
    builds: ["server"]
    package_name: df2-server
    file_name_template: "{{ .ConventionalFileName }}"
    vendor: Defacto2
    homepage: https://github.com/Defacto2/server
    maintainer: Ben Garrett <contact@defacto2.net>
    description: |-
      Defacto2 web server installer package.
    license: Copyright
    formats:
      - deb
    dependencies:
      - git
# signs:
#   - artifacts: checksum
