github.com/joselitofilho/goreleaser@v0.155.1-0.20210123221854-e4891856c593/www/docs/customization/nfpm.md (about) 1 --- 2 title: NFPM 3 --- 4 5 GoReleaser can be wired to [nfpm](https://github.com/goreleaser/nfpm) to 6 generate and publish `.deb`, `.rpm` and `.apk` packages. 7 8 Available options: 9 10 ```yaml 11 # .goreleaser.yml 12 nfpms: 13 # note that this is an array of nfpm configs 14 - 15 # ID of the nfpm config, must be unique. 16 # Defaults to "default". 17 id: foo 18 19 # Name of the package. 20 # Defaults to `ProjectName`. 21 package_name: foo 22 23 # You can change the file name of the package. 24 # Default: `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` 25 file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" 26 27 # Build IDs for the builds you want to create NFPM packages for. 28 # Defaults to all builds. 29 builds: 30 - foo 31 - bar 32 33 # Replacements for GOOS and GOARCH in the package name. 34 # Keys should be valid GOOSs or GOARCHs. 35 # Values are the respective replacements. 36 # Default is empty. 37 replacements: 38 amd64: 64-bit 39 386: 32-bit 40 darwin: macOS 41 linux: Tux 42 43 # Your app's vendor. 44 # Default is empty. 45 vendor: Drum Roll Inc. 46 # Your app's homepage. 47 # Default is empty. 48 homepage: https://example.com/ 49 50 # Your app's maintainer (probably you). 51 # Default is empty. 52 maintainer: Drummer <drum-roll@example.com> 53 54 # Your app's description. 55 # Default is empty. 56 description: Software to create fast and easy drum rolls. 57 58 # Your app's license. 59 # Default is empty. 60 license: Apache 2.0 61 62 # Formats to be generated. 63 formats: 64 - apk 65 - deb 66 - rpm 67 68 # Packages your package depends on. 69 dependencies: 70 - git 71 - zsh 72 73 # Packages your package recommends installing. 74 recommends: 75 - bzr 76 - gtk 77 78 # Packages your package suggests installing. 79 suggests: 80 - cvs 81 - ksh 82 83 # Packages that conflict with your package. 84 conflicts: 85 - svn 86 - bash 87 88 # Packages it replaces. 89 replaces: 90 - fish 91 92 # Override default /usr/local/bin destination for binaries 93 bindir: /usr/bin 94 95 # Version Epoch. 96 # Default is extracted from `version` if it is semver compatible. 97 epoch: 2 98 99 # Version Prerelease. 100 # Default is extracted from `version` if it is semver compatible. 101 prerelease: beta1 102 103 # Version Metadata (previously deb.metadata). 104 # Default is extracted from `version` if it is semver compatible. 105 # Setting metadata might interfere with version comparisons depending on the packager. 106 version_metadata: git 107 108 # Version Release. 109 release: 1 110 111 # Section. 112 section: default 113 114 # Priority. 115 priority: extra 116 117 # Makes a meta package - an empty package that contains only supporting files and dependencies. 118 # When set to `true`, the `builds` option is ignored. 119 # Defaults to false. 120 meta: true 121 122 # Empty folders that should be created and managed by the packager 123 # implementation. 124 # Default is empty. 125 empty_folders: 126 - /var/log/foobar 127 128 # Contents to add to the package. 129 # GoReleaser will automatically add the binaries. 130 contents: 131 # Basic file that applies to all packagers 132 - src: path/to/local/foo 133 dst: /usr/local/bin/foo 134 135 # Simple config file 136 - src: path/to/local/foo.conf 137 dst: /etc/foo.conf 138 type: config 139 140 # Simple symlink. 141 # Corresponds to `ln -s /sbin/foo /usr/local/bin/foo` 142 - src: /sbin/foo 143 dst: /usr/local/bin/foo 144 type: "symlink" 145 146 # Corresponds to `%config(noreplace)` if the packager is rpm, otherwise it is just a config file 147 - src: path/to/local/bar.conf 148 dst: /etc/bar.conf 149 type: "config|noreplace" 150 151 # These files are not actually present in the package, but the file names 152 # are added to the package header. From the RPM directives documentation: 153 # 154 # "There are times when a file should be owned by the package but not 155 # installed - log files and state files are good examples of cases you might 156 # desire this to happen." 157 # 158 # "The way to achieve this, is to use the %ghost directive. By adding this 159 # directive to the line containing a file, RPM will know about the ghosted 160 # file, but will not add it to the package." 161 # 162 # For non rpm packages ghost files are ignored at this time. 163 - dst: /etc/casper.conf 164 type: ghost 165 - dst: /var/log/boo.log 166 type: ghost 167 168 # You can user the packager field to add files that are unique to a specific packager 169 - src: path/to/rpm/file.conf 170 dst: /etc/file.conf 171 type: "config|noreplace" 172 packager: rpm 173 - src: path/to/deb/file.conf 174 dst: /etc/file.conf 175 type: "config|noreplace" 176 packager: deb 177 - src: path/to/apk/file.conf 178 dst: /etc/file.conf 179 type: "config|noreplace" 180 packager: apk 181 182 # Sometimes it is important to be able to set the mtime, mode, owner, or group for a file 183 # that differs from what is on the local build system at build time. 184 - src: path/to/foo 185 dst: /usr/local/foo 186 file_info: 187 mode: 0644 188 mtime: 2008-01-02T15:04:05Z 189 owner: notRoot 190 group: notRoot 191 192 # Scripts to execute during the installation of the package. 193 # Keys are the possible targets during the installation process 194 # Values are the paths to the scripts which will be executed 195 scripts: 196 preinstall: "scripts/preinstall.sh" 197 postinstall: "scripts/postinstall.sh" 198 preremove: "scripts/preremove.sh" 199 postremove: "scripts/postremove.sh" 200 201 # Some attributes can be overridden per package format. 202 overrides: 203 deb: 204 conflicts: 205 - subversion 206 dependencies: 207 - git 208 suggests: 209 - gitk 210 recommends: 211 - tig 212 replaces: 213 - bash 214 empty_folders: 215 - /var/log/bar 216 rpm: 217 replacements: 218 amd64: x86_64 219 name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Arch }}" 220 files: 221 "tmp/man.gz": "/usr/share/man/man8/app.8.gz" 222 config_files: 223 "tmp/app_generated.conf": "/etc/app-rpm.conf" 224 scripts: 225 preinstall: "scripts/preinstall-rpm.sh" 226 227 # Custon configuration applied only to the RPM packager. 228 rpm: 229 # The package summary. 230 # Defaults to the first line of the description. 231 summary: Explicit Summary for Sample Package 232 233 # The package group. This option is deprecated by most distros 234 # but required by old distros like CentOS 5 / EL 5 and earlier. 235 group: Unspecified 236 237 # Compression algorithm. 238 compression: lzma 239 240 # These config files will not be replaced by new versions if they were 241 # changed by the user. Corresponds to %config(noreplace). 242 config_noreplace_files: 243 path/to/local/bar.con: /etc/bar.conf 244 245 # These files are not actually present in the package, but the file names 246 # are added to the package header. From the RPM directives documentation: 247 # 248 # "There are times when a file should be owned by the package but not 249 # installed - log files and state files are good examples of cases you might 250 # desire this to happen." 251 # 252 # "The way to achieve this, is to use the %ghost directive. By adding this 253 # directive to the line containing a file, RPM will know about the ghosted 254 # file, but will not add it to the package." 255 ghost_files: 256 - /etc/casper.conf 257 - /var/log/boo.log 258 259 # The package is signed if a key_file is set 260 signature: 261 # PGP secret key (can also be ASCII-armored). The passphrase is taken 262 # from the environment variable $NFPM_ID_RPM_PASSPHRASE with a fallback 263 # to $NFPM_ID_PASSPHRASE, where ID is the id of the current nfpm config. 264 # The id will be transformed to uppercase. 265 # E.g. If your nfpm id is 'default' then the rpm-specific passphrase 266 # should be set as $NFPM_DEFAULT_RPM_PASSPHRASE 267 key_file: key.gpg 268 269 # Custom configuration applied only to the Deb packager. 270 deb: 271 # Custom deb special files. 272 scripts: 273 # Deb rules script. 274 rules: foo.sh 275 # Deb templates file, when using debconf. 276 templates: templates 277 278 # Custom deb triggers 279 triggers: 280 # register interrest on a trigger activated by another package 281 # (also available: interest_await, interest_noawait) 282 interest: 283 - some-trigger-name 284 # activate a trigger for another package 285 # (also available: activate_await, activate_noawait) 286 activate: 287 - another-trigger-name 288 289 # Packages which would break if this package would be installed. 290 # The installation of this package is blocked if `some-package` 291 # is already installed. 292 breaks: 293 - some-package 294 295 # The package is signed if a key_file is set 296 signature: 297 # PGP secret key (can also be ASCII-armored). The passphrase is taken 298 # from the environment variable $NFPM_ID_DEB_PASSPHRASE with a fallback 299 # to $NFPM_ID_PASSPHRASE, where ID is the id of the current nfpm config. 300 # The id will be transformed to uppercase. 301 # E.g. If your nfpm id is 'default' then the deb-specific passphrase 302 # should be set as $NFPM_DEFAULT_DEB_PASSPHRASE 303 key_file: key.gpg 304 # The type describes the signers role, possible values are "origin", 305 # "maint" and "archive". If unset, the type defaults to "origin". 306 type: origin 307 308 apk: 309 # The package is signed if a key_file is set 310 signature: 311 # RSA private key in the PEM format. The passphrase is taken 312 # from the environment variable $NFPM_ID_APK_PASSPHRASE with a fallback 313 # to $NFPM_ID_PASSPHRASE, where ID is the id of the current nfpm config. 314 # The id will be transformed to uppercase. 315 # E.g. If your nfpm id is 'default' then the deb-specific passphrase 316 # should be set as $NFPM_DEFAULT_APK_PASSPHRASE 317 key_file: key.gpg 318 # The name of the signing key. When verifying a package, the signature 319 # is matched to the public key store in /etc/apk/keys/<key_name>.rsa.pub. 320 # If unset, it defaults to the maintainer email address. 321 key_name: origin 322 ``` 323 324 !!! tip 325 Learn more about the [name template engine](/customization/templates/).