mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-11 14:39:28 +02:00
feat(nfpm): allow to template scripts names
This commit is contained in:
parent
58a6ba4e30
commit
3ed6751bb9
@ -188,6 +188,10 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar
|
||||
&fpm.Homepage,
|
||||
&fpm.Description,
|
||||
&fpm.Maintainer,
|
||||
&overridden.Scripts.PostInstall,
|
||||
&overridden.Scripts.PreInstall,
|
||||
&overridden.Scripts.PostRemove,
|
||||
&overridden.Scripts.PreRemove,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -106,6 +106,7 @@ func TestRunPipe(t *testing.T) {
|
||||
Env: []string{
|
||||
"PRO=pro",
|
||||
"DESC=templates",
|
||||
"EXT=.sh",
|
||||
},
|
||||
NFPMs: []config.NFPM{
|
||||
{
|
||||
@ -132,6 +133,12 @@ func TestRunPipe(t *testing.T) {
|
||||
Provides: []string{"ash"},
|
||||
Release: "10",
|
||||
Epoch: "20",
|
||||
Scripts: config.NFPMScripts{
|
||||
PreInstall: "./testdata/pre_install{{.Env.EXT}}",
|
||||
PostInstall: "./testdata/post_install{{.Env.EXT}}",
|
||||
PreRemove: "./testdata/pre_remove{{.Env.EXT}}",
|
||||
PostRemove: "./testdata/post_remove{{.Env.EXT}}",
|
||||
},
|
||||
Contents: []*files.Content{
|
||||
{
|
||||
Destination: "/var/log/foobar",
|
||||
|
0
internal/pipe/nfpm/testdata/post_install.sh
vendored
Normal file
0
internal/pipe/nfpm/testdata/post_install.sh
vendored
Normal file
0
internal/pipe/nfpm/testdata/post_remove.sh
vendored
Normal file
0
internal/pipe/nfpm/testdata/post_remove.sh
vendored
Normal file
0
internal/pipe/nfpm/testdata/pre_install.sh
vendored
Normal file
0
internal/pipe/nfpm/testdata/pre_install.sh
vendored
Normal file
0
internal/pipe/nfpm/testdata/pre_remove.sh
vendored
Normal file
0
internal/pipe/nfpm/testdata/pre_remove.sh
vendored
Normal file
@ -103,8 +103,19 @@ dockers:
|
||||
# Path to the Dockerfile (from the project root).
|
||||
#
|
||||
# Default: 'Dockerfile'
|
||||
# Templates: allowed.
|
||||
dockerfile: "{{ .Env.DOCKERFILE }}"
|
||||
|
||||
# Use this instead of `dockerfile` if the contents of your Dockerfile are
|
||||
# supposed to go through the template engine as well.
|
||||
#
|
||||
# `dockerfile` is ignored when this is set.
|
||||
#
|
||||
# Since: v1.20 (pro)
|
||||
# This feature is only available in GoReleaser Pro.
|
||||
# Templates: allowed
|
||||
templated_dockerfile: "{{.Env.DOCKERFILE }}"
|
||||
|
||||
# Set the "backend" for the Docker pipe.
|
||||
#
|
||||
# Valid options are: docker, buildx, podman.
|
||||
|
@ -17,13 +17,13 @@ nfpms:
|
||||
|
||||
# Name of the package.
|
||||
# Default: ProjectName
|
||||
# Templates: allowed (since v1.18)
|
||||
# Templates: allowed. (since v1.18)
|
||||
package_name: foo
|
||||
|
||||
# You can change the file name of the package.
|
||||
#
|
||||
# Default: '{{ .PackageName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||
# Templates: allowed
|
||||
# Templates: allowed.
|
||||
file_name_template: "{{ .ConventionalFileName }}"
|
||||
|
||||
# Build IDs for the builds you want to create NFPM packages for.
|
||||
@ -156,7 +156,7 @@ nfpms:
|
||||
# /etc, using the "tree" type.
|
||||
#
|
||||
# Since: v1.17
|
||||
# Templates: allowed
|
||||
# Templates: allowed.
|
||||
- src: some/directory/
|
||||
dst: /etc
|
||||
type: tree
|
||||
@ -188,7 +188,7 @@ nfpms:
|
||||
#
|
||||
# Since: v1.17 (pro)
|
||||
# This feature is only available in GoReleaser Pro.
|
||||
# Templates: allowed
|
||||
# Templates: allowed.
|
||||
templated_contents:
|
||||
# a more complete example, check the globbing deep dive below
|
||||
- src: "LICENSE.md.tpl"
|
||||
@ -261,12 +261,28 @@ nfpms:
|
||||
#
|
||||
# Keys are the possible targets during the installation process
|
||||
# Values are the paths to the scripts which will be executed.
|
||||
#
|
||||
# Templates: allowed (since v1.20).
|
||||
scripts:
|
||||
preinstall: "scripts/preinstall.sh"
|
||||
postinstall: "scripts/postinstall.sh"
|
||||
preremove: "scripts/preremove.sh"
|
||||
postremove: "scripts/postremove.sh"
|
||||
|
||||
# Templated scripts to execute during the installation of the package. (overridable)
|
||||
#
|
||||
# Keys are the possible targets during the installation process
|
||||
# Values are the paths to the scripts which will be executed.
|
||||
#
|
||||
# Since: v1.20 (pro)
|
||||
# This feature is only available in GoReleaser Pro.
|
||||
# Templates: allowed.
|
||||
templated_scripts:
|
||||
preinstall: "scripts/preinstall.sh"
|
||||
postinstall: "scripts/postinstall.sh"
|
||||
preremove: "scripts/preremove.sh"
|
||||
postremove: "scripts/postremove.sh"
|
||||
|
||||
# All fields above marked as `overridable` can be overridden for a given
|
||||
# package format in this section.
|
||||
overrides:
|
||||
@ -330,7 +346,7 @@ nfpms:
|
||||
# E.g. If your nfpm id is 'default' then the rpm-specific passphrase
|
||||
# should be set as `$NFPM_DEFAULT_RPM_PASSPHRASE`
|
||||
#
|
||||
# Templates: allowed
|
||||
# Templates: allowed.
|
||||
key_file: "{{ .Env.GPG_KEY_PATH }}"
|
||||
|
||||
# Custom configuration applied only to the Deb packager.
|
||||
@ -374,7 +390,7 @@ nfpms:
|
||||
# E.g. If your nfpm id is 'default' then the deb-specific passphrase
|
||||
# should be set as `$NFPM_DEFAULT_DEB_PASSPHRASE`
|
||||
#
|
||||
# Templates: allowed
|
||||
# Templates: allowed.
|
||||
key_file: "{{ .Env.GPG_KEY_PATH }}"
|
||||
|
||||
# The type describes the signers role, possible values are "origin",
|
||||
@ -401,14 +417,14 @@ nfpms:
|
||||
# E.g. If your nfpm id is 'default' then the apk-specific passphrase
|
||||
# should be set as `$NFPM_DEFAULT_APK_PASSPHRASE`
|
||||
#
|
||||
# Templates: allowed
|
||||
# Templates: allowed.
|
||||
key_file: "{{ .Env.GPG_KEY_PATH }}"
|
||||
|
||||
# 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.
|
||||
#
|
||||
# Default: maintainer's email address
|
||||
# Templates: allowed (since v1.15)
|
||||
# Templates: allowed. (since v1.15)
|
||||
key_name: origin
|
||||
|
||||
archlinux:
|
||||
|
9
www/docs/static/schema-pro.json
generated
vendored
9
www/docs/static/schema-pro.json
generated
vendored
@ -908,6 +908,9 @@
|
||||
"$ref": "#/$defs/TemplatedExtraFileWithMode"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"templated_dockerfile": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
@ -1786,6 +1789,9 @@
|
||||
"templated_contents": {
|
||||
"$ref": "#/$defs/Contents"
|
||||
},
|
||||
"templated_scripts": {
|
||||
"$ref": "#/$defs/NFPMScripts"
|
||||
},
|
||||
"overrides": {
|
||||
"patternProperties": {
|
||||
".*": {
|
||||
@ -2078,6 +2084,9 @@
|
||||
},
|
||||
"templated_contents": {
|
||||
"$ref": "#/$defs/Contents"
|
||||
},
|
||||
"templated_scripts": {
|
||||
"$ref": "#/$defs/NFPMScripts"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user