# This file was originally part of the project "LURE - Linux User REpository", created by Elara Musayelyan.
# It has been modified as part of "ALR - Any Linux Repository" by Евгений Храмов.
#
# ALR - Any Linux Repository
# Copyright (C) 2025 Евгений Храмов
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

before:
  hooks:
    - go mod tidy
builds:
  - id: alr
    env:
      - CGO_ENABLED=0
    binary: alr
    ldflags:
      - -X gitea.plemya-x.ru/xpamych/ALR/src/branch/master/internal/config.Version={{.Version}}
    goos:
      - linux
    goarch:
      - amd64
      - 386
      - arm64
      - arm
      - riscv64
archives:
  - name_template: >-
      {{- .ProjectName}}-
      {{- .Version}}-
      {{- .Os}}-
      {{- if .Arch | eq "amd64"}}x86_64
      {{- else if .Arch | eq "386"}}i386
      {{- else if .Arch | eq "arm64"}}aarch64
      {{- else }}{{ .Arch }}{{ end -}}
    files:
      - scripts/completion/*
nfpms:
  - id: alr
    package_name: linux-user-repository
    file_name_template: >-
      {{- .PackageName}}-
      {{- .Version}}-
      {{- .Os}}-
      {{- if .Arch | eq "amd64"}}x86_64
      {{- else if .Arch | eq "386"}}i386
      {{- else if .Arch | eq "arm64"}}aarch64
      {{- else }}{{ .Arch }}{{ end -}}
    description: "Any Linux Repository"
    homepage: 'https://gitea.plemya-x.ru/xpamych/ALR'
    maintainer: 'Евгений Храмов <xpamych@yandex.ru>'
    license: GPLv3
    formats:
      - apk
      - deb
      - rpm
      - archlinux
    provides:
      - linux-user-repository
    conflicts:
      - linux-user-repository
    recommends:
      - aria2
    contents:
      - src: scripts/completion/bash
        dst: /usr/share/bash-completion/completions/alr
      - src: scripts/completion/zsh
        dst: /usr/share/zsh/site-functions/_alr
aurs:
  - name: linux-user-repository-bin
    homepage: 'https://gitea.plemya-x.ru/xpamych/ALR'
    description: "Any Linux Repository"
    maintainers:
      - 'Евгений Храмов <xpamych@yandex.ru>'
    license: GPLv3
    private_key: '{{ .Env.AUR_KEY }}'
    git_url: 'ssh://aur@aur.archlinux.org/linux-user-repository-bin.git'
    provides:
      - alr
    conflicts:
      - alr
    depends:
      - sudo
      - pacman
    optdepends:
      - 'aria2: for downloading torrent sources'
    package: |-
      # binaries
      install -Dm755 ./alr "${pkgdir}/usr/bin/alr"

      # completions
      install -Dm755 ./scripts/completion/bash ${pkgdir}/usr/share/bash-completion/completions/alr
      install -Dm755 ./scripts/completion/zsh ${pkgdir}/usr/share/zsh/site-functions/_alr
release:
  gitea:
    owner: alr
    name: alr
gitea_urls:
  api: 'https://gitea.elara.ws/api/v1/'
  download: 'https://gitea.elara.ws'
  skip_tls_verify: false
checksum:
  name_template: 'checksums.txt'
snapshot:
  name_template: "{{ incpatch .Version }}-next"
changelog:
  sort: asc