project_name: chezmoi

before:
  hooks:
  - go mod download all

builds:
- id: chezmoi-cgo-glibc
  env:
  - CGO_ENABLED=1
  goos:
  - linux
  goarch:
  - amd64
  ldflags:
  - '-s'
  - '-w'
  - '-X main.version={{ .Version }}'
  - '-X main.commit={{ .Commit }}'
  - '-X main.date={{ .Date }}'
  - '-X main.builtBy=goreleaser'
- id: chezmoi-cgo-musl
  env:
  - CC=/usr/bin/musl-gcc
  - CGO_ENABLED=1
  goos:
  - linux
  goarch:
  - amd64
  ldflags:
  - '-s'
  - '-w'
  - '-X main.version={{ .Version }}'
  - '-X main.commit={{ .Commit }}'
  - '-X main.date={{ .Date }}'
  - '-X main.builtBy=goreleaser'
  - '-linkmode external'
  - '--extldflags "-static"'
- id: chezmoi-nocgo
  env:
  - CGO_ENABLED=0
  goos:
  - darwin
  - freebsd
  - illumos
  - linux
  - openbsd
  - solaris
  - windows
  goarch:
  - 386
  - amd64
  - arm
  - arm64
  - ppc64
  - ppc64le
  goarm:
  - ""
  ldflags:
  - '-s'
  - '-w'
  - '-X main.version={{ .Version }}'
  - '-X main.commit={{ .Commit }}'
  - '-X main.date={{ .Date }}'
  - '-X main.builtBy=goreleaser'
  ignore:
  - goos: darwin
    goarch: 386
  - goos: linux
    goarch: amd64

archives:
- builds:
  - chezmoi-cgo-glibc # Required for chezmoi upgrade for versions <= 2.0.5
  - chezmoi-nocgo
  files:
  - LICENSE
  - README.md
  - completions/*
  replacements:
    386: i386
  format_overrides:
  - goos: windows
    format: zip
- id: glibc
  builds:
  - chezmoi-cgo-glibc
  files:
  - LICENSE
  - README.md
  - completions/*
  name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}-glibc_{{ .Arch }}"
- id: musl
  builds:
  - chezmoi-cgo-musl
  files:
  - LICENSE
  - README.md
  - completions/*
  name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}-musl_{{ .Arch }}"

changelog:
  sort: asc
  filters:
    exclude:
    - "^chore:"
    - "^chore\\(deps\\):"
    - "^test:"
    - Merge pull request
    - Merge branch

checksum:

nfpms:
- builds:
  - chezmoi-cgo-glibc
  - chezmoi-nocgo
  vendor: "Tom Payne <twpayne@gmail.com>"
  homepage: "https://chezmoi.io/"
  maintainer: "Tom Payne <twpayne@gmail.com>"
  description: "Manage your dotfiles across multiple diverse machines, securely."
  license: MIT
  formats:
  - deb
  - rpm
  dependencies:
  - git
  bindir: /usr/bin
  overrides:
    deb:
      file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
      replacements:
        386: i386
        arm: armel
      contents:
      - src: completions/chezmoi-completion.bash
        dst: /usr/share/bash-completion/completions/chezmoi
      - src: completions/chezmoi.fish
        dst: /usr/share/fish/completions/chezmoi.fish
      - src: completions/chezmoi.zsh
        dst: /usr/share/zsh/vendor-completions/_chezmoi
    rpm:
      file_name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Arch }}"
      replacements:
        amd64: x86_64
        386: i686
        arm: armhfp
        arm64: aarch64
      contents:
      - src: completions/chezmoi-completion.bash
        dst: /usr/share/bash-completion/completions/chezmoi
      - src: completions/chezmoi.fish
        dst: /usr/share/fish/completions/chezmoi.fish
      - src: completions/chezmoi.zsh
        dst: /usr/share/zsh/site-functions/_chezmoi
- id: apks
  builds:
  - chezmoi-cgo-musl
  - chezmoi-nocgo
  vendor: "Tom Payne <twpayne@gmail.com>"
  homepage: "https://chezmoi.io/"
  maintainer: "Tom Payne <twpayne@gmail.com>"
  description: "Manage your dotfiles across multiple diverse machines, securely."
  license: MIT
  formats:
  - apk
  bindir: /usr/bin

release:

scoop:
  bucket:
    owner: twpayne
    name: scoop-bucket
  commit_author:
    name: Tom Payne
    email: twpayne@gmail.com
  homepage: "https://chezmoi.io"
  description: "Manage your dotfiles across multiple diverse machines, securely."
  license: MIT

snapcrafts:
- builds:
  - chezmoi-cgo-glibc
  - chezmoi-nocgo
  summary: "Manage your dotfiles across multiple diverse machines, securely."
  description: "Manage your dotfiles across multiple diverse machines, securely."
  publish: true
  grade: stable
  confinement: classic
  apps:
    chezmoi:
      completer: completions/chezmoi-completion.bash

source:
  enabled: true
  prefix_template: '{{ .ProjectName }}-{{ .Version }}/'
