2021-10-30 09:50:23 -03:00
# Linux packages (via nFPM)
2017-09-10 17:07:28 -03:00
2018-02-18 20:37:59 -03:00
GoReleaser can be wired to [nfpm ](https://github.com/goreleaser/nfpm ) to
2022-11-02 18:30:06 +00:00
generate and publish `.deb` , `.rpm` , `.apk` , and Archlinux packages.
2018-02-18 20:37:59 -03:00
Available options:
2020-05-10 18:59:21 -03:00
```yaml
2021-12-23 01:52:01 +01:00
# .goreleaser.yaml
2019-05-07 06:59:53 -03:00
nfpms:
# note that this is an array of nfpm configs
-
2020-05-10 18:59:21 -03:00
# ID of the nfpm config, must be unique.
2019-05-07 07:18:35 -03:00
# Defaults to "default".
id: foo
2019-11-15 16:00:48 -03:00
# Name of the package.
# Defaults to `ProjectName` .
package_name: foo
# You can change the file name of the package.
2021-11-12 09:07:59 -03:00
#
2022-04-13 21:29:39 -03:00
# Default:`{{ .PackageName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}`
2021-11-12 09:07:59 -03:00
file_name_template: "{{ .ConventionalFileName }}"
2019-05-07 06:59:53 -03:00
# Build IDs for the builds you want to create NFPM packages for.
2022-04-11 23:59:52 -03:00
# Defaults empty, which means no filtering.
2019-05-07 06:59:53 -03:00
builds:
2020-02-26 19:59:52 +08:00
- foo
- bar
2019-05-07 06:59:53 -03:00
# Your app's vendor.
# Default is empty.
vendor: Drum Roll Inc.
2021-05-31 21:59:46 -03:00
# Template to your app's homepage.
2019-05-07 06:59:53 -03:00
# Default is empty.
homepage: https://example.com/
# Your app's maintainer (probably you).
# Default is empty.
maintainer: Drummer < drum-roll @example .com >
2021-05-31 21:59:46 -03:00
# Template to your app's description.
2019-05-07 06:59:53 -03:00
# Default is empty.
2022-01-31 15:13:07 -03:00
description: |-
2022-01-31 18:42:45 +01:00
Drum rolls installer package.
Software to create fast and easy drum rolls.
2019-05-07 06:59:53 -03:00
# Your app's license.
# Default is empty.
license: Apache 2.0
# Formats to be generated.
formats:
2020-08-22 19:00:14 -03:00
- apk
2019-05-07 06:59:53 -03:00
- deb
- rpm
2022-09-11 16:54:51 -03:00
- termux.deb # Since GoReleaser v1.11.
2022-11-16 09:32:54 -03:00
- archlinux # Since GoReleaser v1.13.
2019-05-07 06:59:53 -03:00
2022-08-07 12:13:20 -03:00
# Packages your package depends on. (overridable)
2019-05-07 06:59:53 -03:00
dependencies:
- git
- zsh
2022-08-07 12:13:20 -03:00
# Packages it provides. (overridable)
2022-09-11 16:54:51 -03:00
# Since: v1.11.
2022-08-07 12:13:20 -03:00
provides:
- bar
# Packages your package recommends installing. (overridable)
2019-05-07 06:59:53 -03:00
recommends:
- bzr
- gtk
2022-08-07 12:13:20 -03:00
# Packages your package suggests installing. (overridable)
2019-05-07 06:59:53 -03:00
suggests:
- cvs
- ksh
2022-08-07 12:13:20 -03:00
# Packages that conflict with your package. (overridable)
2019-05-07 06:59:53 -03:00
conflicts:
- svn
- bash
2022-08-07 12:13:20 -03:00
# Packages it replaces. (overridable)
2020-11-06 15:17:08 -03:00
replaces:
- fish
2021-09-07 15:43:06 -03:00
# Template to the path that the binaries should be installed.
2022-02-14 21:54:04 -03:00
# Defaults to `/usr/bin` .
2019-05-07 06:59:53 -03:00
bindir: /usr/bin
2020-12-28 14:40:23 -03:00
# Version Epoch.
# Default is extracted from `version` if it is semver compatible.
epoch: 2
2019-06-29 12:26:01 -03:00
2020-12-28 14:40:23 -03:00
# Version Prerelease.
# Default is extracted from `version` if it is semver compatible.
prerelease: beta1
# Version Metadata (previously deb.metadata).
# Default is extracted from `version` if it is semver compatible.
2022-09-17 00:13:09 -03:00
# Setting metadata might interfere with version comparisons depending on the
# packager.
2020-12-28 14:40:23 -03:00
version_metadata: git
# Version Release.
2020-02-26 19:59:52 +08:00
release: 1
2021-01-05 22:55:16 -03:00
# Section.
section: default
# Priority.
priority: extra
2022-09-17 00:13:09 -03:00
# Makes a meta package - an empty package that contains only supporting
# files and dependencies.
2020-06-19 22:04:10 +08:00
# When set to `true` , the `builds` option is ignored.
# Defaults to false.
meta: true
2022-08-16 02:05:46 -03:00
# Changelog YAML file, see: https://github.com/goreleaser/chglog
#
# You can use goreleaser/chglog to create the changelog for your project,
# pass that changelog yaml file to GoReleaser,
# and it should in turn setup it accordingly for the given available
# formats (deb and rpm at the moment).
#
# Experimental.
2022-09-11 16:54:51 -03:00
# Default: empty.
# Since: v1.11.
2022-08-16 02:05:46 -03:00
changelog: ./foo.yml
2020-12-23 23:07:48 -03:00
# Contents to add to the package.
# GoReleaser will automatically add the binaries.
contents:
# Basic file that applies to all packagers
2022-12-31 12:17:38 -03:00
- src: path/to/foo
dst: /usr/bin/foo
2020-12-23 23:07:48 -03:00
# Simple config file
2022-12-31 12:17:38 -03:00
- src: path/to/foo.conf
2020-12-23 23:07:48 -03:00
dst: /etc/foo.conf
type: config
2020-12-30 15:49:44 -03:00
# Simple symlink.
# Corresponds to `ln -s /sbin/foo /usr/local/bin/foo`
- src: /sbin/foo
2022-12-31 12:17:38 -03:00
dst: /usr/bin/foo
2020-12-23 23:07:48 -03:00
type: "symlink"
2022-09-17 00:13:09 -03:00
# Corresponds to `%config(noreplace)` if the packager is rpm, otherwise it
# is just a config file
2020-12-23 23:07:48 -03:00
- src: path/to/local/bar.conf
dst: /etc/bar.conf
type: "config|noreplace"
2021-05-31 00:28:11 -03:00
# The src and dst attributes also supports name templates
2021-05-20 19:21:48 +02:00
- src: path/{{ .Os }}-{{ .Arch }}/bar.conf
2021-05-31 00:28:11 -03:00
dst: /etc/foo/bar-{{ .ProjectName }}.conf
2021-05-20 19:21:48 +02:00
2020-12-23 23:07:48 -03:00
# These files are not actually present in the package, but the file names
# are added to the package header. From the RPM directives documentation:
#
# "There are times when a file should be owned by the package but not
2022-09-17 00:13:09 -03:00
# installed - log files and state files are good examples of cases you
# might desire this to happen."
2020-12-23 23:07:48 -03:00
#
# "The way to achieve this, is to use the %ghost directive. By adding this
# directive to the line containing a file, RPM will know about the ghosted
# file, but will not add it to the package."
#
# For non rpm packages ghost files are ignored at this time.
- dst: /etc/casper.conf
type: ghost
- dst: /var/log/boo.log
type: ghost
2022-09-17 00:13:09 -03:00
# You can use the packager field to add files that are unique to a
# specific packager
2020-12-23 23:07:48 -03:00
- src: path/to/rpm/file.conf
dst: /etc/file.conf
type: "config|noreplace"
packager: rpm
- src: path/to/deb/file.conf
dst: /etc/file.conf
type: "config|noreplace"
packager: deb
- src: path/to/apk/file.conf
dst: /etc/file.conf
type: "config|noreplace"
packager: apk
2022-09-17 00:13:09 -03:00
# Sometimes it is important to be able to set the mtime, mode, owner, or
# group for a file that differs from what is on the local build system at
# build time.
2020-12-23 23:07:48 -03:00
- src: path/to/foo
dst: /usr/local/foo
file_info:
mode: 0644
mtime: 2008-01-02T15:04:05Z
owner: notRoot
group: notRoot
2020-11-26 23:45:17 -03:00
2022-11-20 14:22:19 -03:00
# If `dst` ends with a `/` , it'll create the given path and copy the given
# `src` into it, the same way `cp` works with and without trailing `/` .
- src: ./foo/bar/*
dst: /usr/local/myapp/
2022-09-17 00:13:09 -03:00
# Using the type 'dir', empty directories can be created. When building
# RPMs, however, this type has another important purpose: Claiming
# ownership of that folder. This is important because when upgrading or
# removing an RPM package, only the directories for which it has claimed
2022-09-24 22:42:30 -03:00
# ownership are removed. However, you should not claim ownership of a
# folder that is created by the OS or a dependency of your package.
#
2022-09-17 00:13:09 -03:00
# A directory in the build environment can optionally be provided in the
# 'src' field in order copy mtime and mode from that directory without
# having to specify it manually.
2021-11-13 22:23:11 -03:00
- dst: /some/dir
type: dir
file_info:
mode: 0700
2022-09-24 22:42:30 -03:00
# Scripts to execute during the installation of the package. (overridable)
#
2019-05-07 06:59:53 -03:00
# Keys are the possible targets during the installation process
2022-09-24 22:42:30 -03:00
# Values are the paths to the scripts which will be executed.
2019-05-07 06:59:53 -03:00
scripts:
preinstall: "scripts/preinstall.sh"
postinstall: "scripts/postinstall.sh"
preremove: "scripts/preremove.sh"
postremove: "scripts/postremove.sh"
2022-09-24 22:42:30 -03:00
# All fields above marked as `overridable` can be overridden for a given
# package format in this section.
2019-05-07 06:59:53 -03:00
overrides:
2022-09-24 22:42:30 -03:00
# The depends override can for example be used to provide version
# constraints for dependencies where different package formats use
# different versions or for dependencies that are named differently.
2019-05-07 06:59:53 -03:00
deb:
2022-09-24 22:42:30 -03:00
depends:
- baz (>= 1.2.3-0)
- some-lib-dev
# ...
2019-05-07 06:59:53 -03:00
rpm:
2022-09-24 22:42:30 -03:00
depends:
- baz >= 1.2.3-0
- some-lib-devel
# ...
apk:
# ...
2020-11-05 21:47:55 +00:00
2021-04-28 16:01:03 +03:00
# Custom configuration applied only to the RPM packager.
2020-11-05 21:47:55 +00:00
rpm:
2021-04-28 16:01:03 +03:00
# RPM specific scripts.
scripts:
# The pretrans script runs before all RPM package transactions / stages.
pretrans: ./scripts/pretrans.sh
# The posttrans script runs after all RPM package transactions / stages.
posttrans: ./scripts/posttrans.sh
2022-09-24 22:42:30 -03:00
# The package summary. This is, by default, the first line of the
# description, but can be explicitly provided here.
2020-11-12 10:46:55 -03:00
# Defaults to the first line of the description.
summary: Explicit Summary for Sample Package
2020-11-05 21:47:55 +00:00
# The package group. This option is deprecated by most distros
# but required by old distros like CentOS 5 / EL 5 and earlier.
group: Unspecified
2022-09-24 22:42:30 -03:00
# The packager is used to identify the organization that actually packaged
# the software, as opposed to the author of the software.
# `maintainer` will be used as fallback if not specified.
# This will expand any env var you set in the field, eg packager: ${PACKAGER}
packager: GoReleaser < staff @goreleaser .com >
2020-11-05 21:47:55 +00:00
2022-09-24 22:42:30 -03:00
# Compression algorithm (gzip (default), lzma or xz).
compression: lzma
2020-11-12 10:46:55 -03:00
2020-11-05 21:47:55 +00:00
# The package is signed if a key_file is set
signature:
2021-09-01 10:27:08 -03:00
# Template to the PGP secret key file path (can also be ASCII-armored).
# The passphrase is taken from the environment variable
# `$NFPM_ID_RPM_PASSPHRASE` with a fallback to `$NFPM_ID_PASSPHRASE` ,
# where ID is the id of the current nfpm config.
2020-11-05 21:47:55 +00:00
# The id will be transformed to uppercase.
# E.g. If your nfpm id is 'default' then the rpm-specific passphrase
2021-09-01 10:27:08 -03:00
# should be set as `$NFPM_DEFAULT_RPM_PASSPHRASE`
key_file: '{{ .Env.GPG_KEY_PATH }}'
2020-11-05 21:47:55 +00:00
# Custom configuration applied only to the Deb packager.
deb:
2022-02-09 11:40:51 -03:00
# Lintian overrides
lintian_overrides:
- statically-linked-binary
- changelog-file-missing-in-native-package
2020-11-18 13:55:14 +01:00
# Custom deb special files.
2020-11-05 21:47:55 +00:00
scripts:
2020-11-18 13:55:14 +01:00
# Deb rules script.
2020-11-05 21:47:55 +00:00
rules: foo.sh
# Deb templates file, when using debconf.
templates: templates
# Custom deb triggers
triggers:
2022-06-26 03:30:10 +03:00
# register interest on a trigger activated by another package
2020-11-05 21:47:55 +00:00
# (also available: interest_await, interest_noawait)
interest:
- some-trigger-name
# activate a trigger for another package
# (also available: activate_await, activate_noawait)
activate:
- another-trigger-name
# Packages which would break if this package would be installed.
# The installation of this package is blocked if `some-package`
# is already installed.
breaks:
- some-package
# The package is signed if a key_file is set
signature:
2021-09-01 10:27:08 -03:00
# Template to the PGP secret key file path (can also be ASCII-armored).
# The passphrase is taken from the environment variable
# `$NFPM_ID_DEB_PASSPHRASE` with a fallback to `$NFPM_ID_PASSPHRASE` ,
# where ID is the id of the current nfpm config.
2020-11-05 21:47:55 +00:00
# The id will be transformed to uppercase.
# E.g. If your nfpm id is 'default' then the deb-specific passphrase
2021-09-01 10:27:08 -03:00
# should be set as `$NFPM_DEFAULT_DEB_PASSPHRASE`
key_file: '{{ .Env.GPG_KEY_PATH }}'
2020-11-05 21:47:55 +00:00
# The type describes the signers role, possible values are "origin",
# "maint" and "archive". If unset, the type defaults to "origin".
type: origin
apk:
2021-06-20 19:34:09 +02:00
# APK specific scripts.
scripts:
# The preupgrade script runs before APK upgrade.
preupgrade: ./scripts/preupgrade.sh
# The postupgrade script runs after APK.
postupgrade: ./scripts/postupgrade.sh
2020-11-05 21:47:55 +00:00
# The package is signed if a key_file is set
signature:
2021-09-01 10:27:08 -03:00
# Template to the PGP secret key file path (can also be ASCII-armored).
# The passphrase is taken from the environment variable
# `$NFPM_ID_APK_PASSPHRASE` with a fallback to `$NFPM_ID_PASSPHRASE` ,
# where ID is the id of the current nfpm config.
2020-11-05 21:47:55 +00:00
# The id will be transformed to uppercase.
2021-09-01 10:27:08 -03:00
# E.g. If your nfpm id is 'default' then the apk-specific passphrase
# should be set as `$NFPM_DEFAULT_APK_PASSPHRASE`
key_file: '{{ .Env.GPG_KEY_PATH }}'
2020-11-05 21:47:55 +00:00
# The name of the signing key. When verifying a package, the signature
# is matched to the public key store in /etc/apk/keys/< key_name > .rsa.pub.
# If unset, it defaults to the maintainer email address.
key_name: origin
2022-11-02 18:30:06 +00:00
archlinux:
# Archlinux-specific scripts
scripts:
# The preupgrade script runs before pacman upgrades the package.
preupgrade: ./scripts/preupgrade.sh
# The postupgrade script runs after pacman upgrades the package.
postupgrade: ./scripts/postupgrade.sh
2022-11-16 09:32:54 -03:00
2022-11-02 18:30:06 +00:00
# The pkgbase can be used to explicitly specify the name to be used to refer
# to a group of packages. See: https://wiki.archlinux.org/title/PKGBUILD#pkgbase .
pkgbase: foo
# The packager refers to the organization packaging the software, not to be confused
# with the maintainer, which is the person who maintains the software.
packager: GoReleaser < staff @goreleaser .com >
2018-02-18 20:37:59 -03:00
```
2020-05-10 18:59:21 -03:00
!!! tip
2020-11-19 12:31:26 -08:00
Learn more about the [name template engine ](/customization/templates/ ).
2022-08-07 12:13:20 -03:00
!!! info
Fields marked with "overridable" can be overriden for any format.
2022-08-22 09:29:55 -03:00
## A note about Termux
Termux is the same format as `deb` , the differences are:
- it uses a different `bindir` (prefixed with `/data/data/com.termux/files/` )
- it uses slightly different architecture names than Debian