2017-09-10 22:07:28 +02:00
|
|
|
---
|
2018-06-25 15:06:08 +02:00
|
|
|
title: NFPM
|
2017-09-10 22:07:28 +02:00
|
|
|
---
|
|
|
|
|
2018-02-19 01:37:59 +02:00
|
|
|
GoReleaser can be wired to [nfpm](https://github.com/goreleaser/nfpm) to
|
2020-10-27 14:29:54 +02:00
|
|
|
generate and publish `.deb`, `.rpm` and `.apk` packages.
|
2018-02-19 01:37:59 +02:00
|
|
|
|
|
|
|
Available options:
|
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
```yaml
|
2018-02-19 01:37:59 +02:00
|
|
|
# .goreleaser.yml
|
2019-05-07 11:59:53 +02:00
|
|
|
nfpms:
|
|
|
|
# note that this is an array of nfpm configs
|
|
|
|
-
|
2020-05-10 23:59:21 +02:00
|
|
|
# ID of the nfpm config, must be unique.
|
2019-05-07 12:18:35 +02:00
|
|
|
# Defaults to "default".
|
|
|
|
id: foo
|
2019-11-15 21:00:48 +02:00
|
|
|
|
|
|
|
# Name of the package.
|
|
|
|
# Defaults to `ProjectName`.
|
|
|
|
package_name: foo
|
|
|
|
|
|
|
|
# You can change the file name of the package.
|
2020-02-06 03:08:18 +02:00
|
|
|
# Default: `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}`
|
2019-11-15 21:00:48 +02:00
|
|
|
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
2019-05-07 11:59:53 +02:00
|
|
|
|
|
|
|
# Build IDs for the builds you want to create NFPM packages for.
|
|
|
|
# Defaults to all builds.
|
|
|
|
builds:
|
2020-02-26 13:59:52 +02:00
|
|
|
- foo
|
|
|
|
- bar
|
2019-05-07 11:59:53 +02:00
|
|
|
|
|
|
|
# Replacements for GOOS and GOARCH in the package name.
|
|
|
|
# Keys should be valid GOOSs or GOARCHs.
|
|
|
|
# Values are the respective replacements.
|
|
|
|
# Default is empty.
|
|
|
|
replacements:
|
|
|
|
amd64: 64-bit
|
|
|
|
386: 32-bit
|
|
|
|
darwin: macOS
|
|
|
|
linux: Tux
|
|
|
|
|
|
|
|
# Your app's vendor.
|
|
|
|
# Default is empty.
|
|
|
|
vendor: Drum Roll Inc.
|
|
|
|
# Your app's homepage.
|
|
|
|
# Default is empty.
|
|
|
|
homepage: https://example.com/
|
|
|
|
|
|
|
|
# Your app's maintainer (probably you).
|
|
|
|
# Default is empty.
|
|
|
|
maintainer: Drummer <drum-roll@example.com>
|
|
|
|
|
|
|
|
# Your app's description.
|
|
|
|
# Default is empty.
|
|
|
|
description: Software to create fast and easy drum rolls.
|
|
|
|
|
|
|
|
# Your app's license.
|
|
|
|
# Default is empty.
|
|
|
|
license: Apache 2.0
|
|
|
|
|
|
|
|
# Formats to be generated.
|
|
|
|
formats:
|
2020-08-23 00:00:14 +02:00
|
|
|
- apk
|
2019-05-07 11:59:53 +02:00
|
|
|
- deb
|
|
|
|
- rpm
|
|
|
|
|
|
|
|
# Packages your package depends on.
|
|
|
|
dependencies:
|
|
|
|
- git
|
|
|
|
- zsh
|
|
|
|
|
|
|
|
# Packages your package recommends installing.
|
|
|
|
recommends:
|
|
|
|
- bzr
|
|
|
|
- gtk
|
|
|
|
|
|
|
|
# Packages your package suggests installing.
|
|
|
|
suggests:
|
|
|
|
- cvs
|
|
|
|
- ksh
|
|
|
|
|
|
|
|
# Packages that conflict with your package.
|
|
|
|
conflicts:
|
|
|
|
- svn
|
|
|
|
- bash
|
|
|
|
|
2020-11-06 20:17:08 +02:00
|
|
|
# Packages it replaces.
|
|
|
|
replaces:
|
|
|
|
- fish
|
|
|
|
|
2019-05-07 11:59:53 +02:00
|
|
|
# Override default /usr/local/bin destination for binaries
|
|
|
|
bindir: /usr/bin
|
|
|
|
|
2020-12-28 19:40:23 +02:00
|
|
|
# Version Epoch.
|
|
|
|
# Default is extracted from `version` if it is semver compatible.
|
|
|
|
epoch: 2
|
2019-06-29 17:26:01 +02:00
|
|
|
|
2020-12-28 19:40:23 +02: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.
|
|
|
|
# Setting metadata might interfere with version comparisons depending on the packager.
|
|
|
|
version_metadata: git
|
|
|
|
|
|
|
|
# Version Release.
|
2020-02-26 13:59:52 +02:00
|
|
|
release: 1
|
|
|
|
|
2021-01-06 03:55:16 +02:00
|
|
|
# Section.
|
|
|
|
section: default
|
|
|
|
|
|
|
|
# Priority.
|
|
|
|
priority: extra
|
|
|
|
|
2020-06-19 16:04:10 +02:00
|
|
|
# Makes a meta package - an empty package that contains only supporting files and dependencies.
|
|
|
|
# When set to `true`, the `builds` option is ignored.
|
|
|
|
# Defaults to false.
|
|
|
|
meta: true
|
|
|
|
|
2019-05-07 11:59:53 +02:00
|
|
|
# Empty folders that should be created and managed by the packager
|
|
|
|
# implementation.
|
|
|
|
# Default is empty.
|
|
|
|
empty_folders:
|
2020-02-26 13:59:52 +02:00
|
|
|
- /var/log/foobar
|
2019-05-07 11:59:53 +02:00
|
|
|
|
2020-12-24 04:07:48 +02:00
|
|
|
# Contents to add to the package.
|
|
|
|
# GoReleaser will automatically add the binaries.
|
|
|
|
contents:
|
|
|
|
# Basic file that applies to all packagers
|
|
|
|
- src: path/to/local/foo
|
|
|
|
dst: /usr/local/bin/foo
|
|
|
|
|
|
|
|
# Simple config file
|
|
|
|
- src: path/to/local/foo.conf
|
|
|
|
dst: /etc/foo.conf
|
|
|
|
type: config
|
|
|
|
|
2020-12-30 20:49:44 +02:00
|
|
|
# Simple symlink.
|
|
|
|
# Corresponds to `ln -s /sbin/foo /usr/local/bin/foo`
|
|
|
|
- src: /sbin/foo
|
|
|
|
dst: /usr/local/bin/foo
|
2020-12-24 04:07:48 +02:00
|
|
|
type: "symlink"
|
|
|
|
|
2020-12-30 20:49:44 +02:00
|
|
|
# Corresponds to `%config(noreplace)` if the packager is rpm, otherwise it is just a config file
|
2020-12-24 04:07:48 +02:00
|
|
|
- src: path/to/local/bar.conf
|
|
|
|
dst: /etc/bar.conf
|
|
|
|
type: "config|noreplace"
|
|
|
|
|
|
|
|
# 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
|
|
|
|
# installed - log files and state files are good examples of cases you might
|
|
|
|
# desire this to happen."
|
|
|
|
#
|
|
|
|
# "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
|
|
|
|
|
|
|
|
# You can user the packager field to add files that are unique to a specific packager
|
|
|
|
- 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
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
- src: path/to/foo
|
|
|
|
dst: /usr/local/foo
|
|
|
|
file_info:
|
|
|
|
mode: 0644
|
|
|
|
mtime: 2008-01-02T15:04:05Z
|
|
|
|
owner: notRoot
|
|
|
|
group: notRoot
|
2020-11-27 04:45:17 +02:00
|
|
|
|
2019-05-07 11:59:53 +02:00
|
|
|
# Scripts to execute during the installation of the package.
|
|
|
|
# Keys are the possible targets during the installation process
|
|
|
|
# Values are the paths to the scripts which will be executed
|
|
|
|
scripts:
|
|
|
|
preinstall: "scripts/preinstall.sh"
|
|
|
|
postinstall: "scripts/postinstall.sh"
|
|
|
|
preremove: "scripts/preremove.sh"
|
|
|
|
postremove: "scripts/postremove.sh"
|
|
|
|
|
2020-11-06 20:17:08 +02:00
|
|
|
# Some attributes can be overridden per package format.
|
2019-05-07 11:59:53 +02:00
|
|
|
overrides:
|
|
|
|
deb:
|
|
|
|
conflicts:
|
|
|
|
- subversion
|
|
|
|
dependencies:
|
|
|
|
- git
|
|
|
|
suggests:
|
|
|
|
- gitk
|
|
|
|
recommends:
|
|
|
|
- tig
|
2020-11-06 20:17:08 +02:00
|
|
|
replaces:
|
|
|
|
- bash
|
2019-05-07 11:59:53 +02:00
|
|
|
empty_folders:
|
2020-02-26 13:59:52 +02:00
|
|
|
- /var/log/bar
|
2019-05-07 11:59:53 +02:00
|
|
|
rpm:
|
|
|
|
replacements:
|
|
|
|
amd64: x86_64
|
|
|
|
name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Arch }}"
|
|
|
|
files:
|
|
|
|
"tmp/man.gz": "/usr/share/man/man8/app.8.gz"
|
|
|
|
config_files:
|
|
|
|
"tmp/app_generated.conf": "/etc/app-rpm.conf"
|
|
|
|
scripts:
|
|
|
|
preinstall: "scripts/preinstall-rpm.sh"
|
2020-11-05 23:47:55 +02:00
|
|
|
|
|
|
|
# Custon configuration applied only to the RPM packager.
|
|
|
|
rpm:
|
2020-11-12 15:46:55 +02:00
|
|
|
# The package summary.
|
|
|
|
# Defaults to the first line of the description.
|
|
|
|
summary: Explicit Summary for Sample Package
|
|
|
|
|
2020-11-05 23:47:55 +02: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
|
|
|
|
|
|
|
|
# Compression algorithm.
|
|
|
|
compression: lzma
|
|
|
|
|
|
|
|
# These config files will not be replaced by new versions if they were
|
|
|
|
# changed by the user. Corresponds to %config(noreplace).
|
|
|
|
config_noreplace_files:
|
|
|
|
path/to/local/bar.con: /etc/bar.conf
|
|
|
|
|
2020-11-12 15:46:55 +02: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
|
|
|
|
# installed - log files and state files are good examples of cases you might
|
|
|
|
# desire this to happen."
|
|
|
|
#
|
|
|
|
# "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."
|
|
|
|
ghost_files:
|
|
|
|
- /etc/casper.conf
|
|
|
|
- /var/log/boo.log
|
|
|
|
|
2020-11-05 23:47:55 +02:00
|
|
|
# The package is signed if a key_file is set
|
|
|
|
signature:
|
|
|
|
# PGP secret key (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.
|
|
|
|
# The id will be transformed to uppercase.
|
|
|
|
# E.g. If your nfpm id is 'default' then the rpm-specific passphrase
|
|
|
|
# should be set as $NFPM_DEFAULT_RPM_PASSPHRASE
|
|
|
|
key_file: key.gpg
|
|
|
|
|
|
|
|
# Custom configuration applied only to the Deb packager.
|
|
|
|
deb:
|
2020-11-18 14:55:14 +02:00
|
|
|
# Custom deb special files.
|
2020-11-05 23:47:55 +02:00
|
|
|
scripts:
|
2020-11-18 14:55:14 +02:00
|
|
|
# Deb rules script.
|
2020-11-05 23:47:55 +02:00
|
|
|
rules: foo.sh
|
|
|
|
# Deb templates file, when using debconf.
|
|
|
|
templates: templates
|
|
|
|
|
|
|
|
# Custom deb triggers
|
|
|
|
triggers:
|
|
|
|
# register interrest on a trigger activated by another package
|
|
|
|
# (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:
|
|
|
|
# PGP secret key (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.
|
|
|
|
# The id will be transformed to uppercase.
|
|
|
|
# E.g. If your nfpm id is 'default' then the deb-specific passphrase
|
|
|
|
# should be set as $NFPM_DEFAULT_DEB_PASSPHRASE
|
|
|
|
key_file: key.gpg
|
|
|
|
# The type describes the signers role, possible values are "origin",
|
|
|
|
# "maint" and "archive". If unset, the type defaults to "origin".
|
|
|
|
type: origin
|
|
|
|
|
|
|
|
apk:
|
|
|
|
# The package is signed if a key_file is set
|
|
|
|
signature:
|
|
|
|
# RSA private key in the PEM format. 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.
|
|
|
|
# The id will be transformed to uppercase.
|
|
|
|
# E.g. If your nfpm id is 'default' then the deb-specific passphrase
|
|
|
|
# should be set as $NFPM_DEFAULT_APK_PASSPHRASE
|
|
|
|
key_file: key.gpg
|
|
|
|
# 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
|
2018-02-19 01:37:59 +02:00
|
|
|
```
|
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
!!! tip
|
2020-11-19 22:31:26 +02:00
|
|
|
Learn more about the [name template engine](/customization/templates/).
|