version: 2
env:
  - GO111MODULE=on
  - CGO_ENABLED=0

before:
  hooks:
    - ./scripts/manpages.sh
    - ./scripts/completions.sh

builds:
  -
    binary: portier-cli
    ldflags: -s -w -X main.version={{ .Version }}
    goos:
      - linux
      - darwin
      - windows
    goarch:
      - amd64
      - arm64
      - arm

archives:
  -
    builds:
      - portier-cli
    format_overrides:
      - goos: windows
        format: zip

nfpms:
  - builds:
      - portier-cli
    vendor: MH.DX UG
    homepage:  https://github.com/MH-DX/portier-cli
    maintainer: "Mario Hammer <contact@portier.dev>"
    description: "Remotely access all your machines through Portier CLI. It's easy, efficient and reliable. For more info, visit portier.dev"
    license: GPL-3.0
    formats:
      - apk
      - deb
      - rpm
    bindir: /usr/bin
    contents:
      - src: ./manpages/portier-cli.1.gz
        dst: /usr/share/man/man1/portier-cli.1.gz
        file_info:
          mode: 0644
      - src: ./completions/portier-cli.bash
        dst: /usr/share/bash-completion/completions/portier-cli
        file_info:
          mode: 0644
      - src: ./completions/portier-cli.fish
        dst: /usr/share/fish/vendor_completions.d/portier-cli.fish
        file_info:
          mode: 0644
      - src: ./completions/portier-cli.zsh
        dst:  /usr/share/zsh/vendor-completions/_portier-cli
        file_info:
          mode: 0644

dockers:
- image_templates:
  - 'mh-dx/{{.ProjectName}}:{{ .Tag }}-amd64'
  - 'ghcr.io/mh-dx/{{.ProjectName}}:{{ .Tag }}-amd64'
  dockerfile: Dockerfile
  use: buildx
  build_flag_templates:
  - "--pull"
  - "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/mh-dx/portier-cli/master/README.md"
  - "--label=io.artifacthub.package.maintainers=[{\"name\":\"Mario Hammer\",\"email\":\"contact@portier.dev\"}]"
  - "--label=io.artifacthub.package.license=MIT"
  - "--label=org.opencontainers.image.description=Remotely access all your machines through Portier CLI. It's easy, efficient and reliable. For more info, visit portier.dev"
  - "--label=org.opencontainers.image.created={{.Date}}"
  - "--label=org.opencontainers.image.name={{.ProjectName}}"
  - "--label=org.opencontainers.image.revision={{.FullCommit}}"
  - "--label=org.opencontainers.image.version={{.Version}}"
  - "--label=org.opencontainers.image.source={{.GitURL}}"
  - "--platform=linux/amd64"
- image_templates:
  - 'mh-dx/{{.ProjectName}}:{{ .Tag }}-arm64'
  - 'ghcr.io/mh-dx/{{.ProjectName}}:{{ .Tag }}-arm64'
  dockerfile:  Dockerfile
  use: buildx
  build_flag_templates:
  - "--pull"
  - "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/mh-dx/portier-cli/master/README.md"
  - "--label=io.artifacthub.package.logo-url=https://raw.githubusercontent.com/mh-dx/portier-cli/master/www/static/images/logo.png"
  - "--label=io.artifacthub.package.maintainers=[{\"name\":\"Mario Hammer\",\"email\":\"contact@portier.dev\"}]"
  - "--label=io.artifacthub.package.license=MIT"
  - "--label=org.opencontainers.image.description=Remotely access all your machines through Portier CLI. It's easy, efficient and reliable. For more info, visit portier.dev"
  - "--label=org.opencontainers.image.created={{.Date}}"
  - "--label=org.opencontainers.image.name={{.ProjectName}}"
  - "--label=org.opencontainers.image.revision={{.FullCommit}}"
  - "--label=org.opencontainers.image.version={{.Version}}"
  - "--label=org.opencontainers.image.source={{.GitURL}}"
  - "--platform=linux/arm64"
  goarch: arm64

docker_manifests:
- name_template: 'mh-dx/{{.ProjectName}}:{{ .Tag }}'
  image_templates:
  - 'mh-dx/{{.ProjectName}}:{{ .Tag }}-amd64'
  - 'mh-dx/{{.ProjectName}}:{{ .Tag }}-arm64'
- name_template: 'ghcr.io/mh-dx/{{.ProjectName}}:{{ .Tag }}'
  image_templates:
  - 'ghcr.io/mh-dx/{{.ProjectName}}:{{ .Tag }}-amd64'
  - 'ghcr.io/mh-dx/{{.ProjectName}}:{{ .Tag }}-arm64'
- name_template: 'mh-dx/{{.ProjectName}}:latest'
  image_templates:
  - 'mh-dx/{{.ProjectName}}:{{ .Tag }}-amd64'
  - 'mh-dx/{{.ProjectName}}:{{ .Tag }}-arm64'
- name_template: 'ghcr.io/mh-dx/{{.ProjectName}}:latest'
  image_templates:
  - 'ghcr.io/mh-dx/{{.ProjectName}}:{{ .Tag }}-amd64'
  - 'ghcr.io/mh-dx/{{.ProjectName}}:{{ .Tag }}-arm64'

checksum:
  name_template: "checksums.txt"