mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-11 14:39:28 +02:00
feat: remove deprecated replacements (#4075)
since this will be a late, big release, let's remove the deprecated stuff that expired --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
2e2bde5090
commit
66cee9493c
@ -146,20 +146,10 @@ type command struct {
|
||||
// Those variables can be replaced by the given context, goos, goarch, goarm and more.
|
||||
func resolveCommand(ctx *context.Context, publisher config.Publisher, artifact *artifact.Artifact) (*command, error) {
|
||||
var err error
|
||||
|
||||
replacements := make(map[string]string)
|
||||
// TODO: Replacements should be associated only with relevant artifacts/archives
|
||||
// this is pretty much all wrong and will be removed soon.
|
||||
archives := ctx.Config.Archives
|
||||
if len(archives) > 0 {
|
||||
replacements = archives[0].Replacements
|
||||
}
|
||||
|
||||
dir := publisher.Dir
|
||||
|
||||
// nolint:staticcheck
|
||||
tpl := tmpl.New(ctx).
|
||||
WithArtifactReplacements(artifact, replacements)
|
||||
tpl := tmpl.New(ctx).WithArtifact(artifact)
|
||||
if dir != "" {
|
||||
dir, err = tpl.Apply(dir)
|
||||
if err != nil {
|
||||
|
@ -16,13 +16,6 @@ import (
|
||||
func TestExecute(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
ProjectName: "blah",
|
||||
Archives: []config.Archive{
|
||||
{
|
||||
Replacements: map[string]string{
|
||||
"linux": "Linux",
|
||||
},
|
||||
},
|
||||
},
|
||||
Env: []string{
|
||||
"TEST_A_SECRET=x",
|
||||
"TEST_A_USERNAME=u2",
|
||||
|
@ -216,7 +216,7 @@ func uploadAsset(ctx *context.Context, upload *config.Upload, artifact *artifact
|
||||
secret := getPassword(ctx, upload, kind)
|
||||
|
||||
// Generate the target url
|
||||
targetURL, err := resolveTargetTemplate(ctx, upload, artifact)
|
||||
targetURL, err := tmpl.New(ctx).WithArtifact(artifact).Apply(upload.Target)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %s: error while building target URL: %w", upload.Name, kind, err)
|
||||
}
|
||||
@ -241,7 +241,7 @@ func uploadAsset(ctx *context.Context, upload *config.Upload, artifact *artifact
|
||||
headers := map[string]string{}
|
||||
if upload.CustomHeaders != nil {
|
||||
for name, value := range upload.CustomHeaders {
|
||||
resolvedValue, err := resolveHeaderTemplate(ctx, upload, artifact, value)
|
||||
resolvedValue, err := tmpl.New(ctx).WithArtifact(artifact).Apply(value)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %s: failed to resolve custom_headers template: %w", upload.Name, kind, err)
|
||||
}
|
||||
@ -361,34 +361,3 @@ func executeHTTPRequest(ctx *context.Context, upload *config.Upload, req *h.Requ
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// resolveTargetTemplate returns the resolved target template with replaced variables
|
||||
// Those variables can be replaced by the given context, goos, goarch, goarm and more.
|
||||
func resolveTargetTemplate(ctx *context.Context, upload *config.Upload, artifact *artifact.Artifact) (string, error) {
|
||||
replacements := map[string]string{}
|
||||
if upload.Mode == ModeBinary {
|
||||
// TODO: multiple archives here
|
||||
// will be removed soon anyway
|
||||
replacements = ctx.Config.Archives[0].Replacements
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
return tmpl.New(ctx).
|
||||
WithArtifactReplacements(artifact, replacements).
|
||||
Apply(upload.Target)
|
||||
}
|
||||
|
||||
// resolveHeaderTemplate returns the resolved custom header template with replaced variables
|
||||
// Those variables can be replaced by the given context, goos, goarch, goarm and more.
|
||||
func resolveHeaderTemplate(ctx *context.Context, upload *config.Upload, artifact *artifact.Artifact, headerValue string) (string, error) {
|
||||
replacements := map[string]string{}
|
||||
if upload.Mode == ModeBinary {
|
||||
// TODO: multiple archives here
|
||||
// will be removed soon anyway
|
||||
replacements = ctx.Config.Archives[0].Replacements
|
||||
}
|
||||
// nolint:staticcheck
|
||||
return tmpl.New(ctx).
|
||||
WithArtifactReplacements(artifact, replacements).
|
||||
Apply(headerValue)
|
||||
}
|
||||
|
@ -229,13 +229,6 @@ func TestUpload(t *testing.T) {
|
||||
}
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
ProjectName: "blah",
|
||||
Archives: []config.Archive{
|
||||
{
|
||||
Replacements: map[string]string{
|
||||
"linux": "Linux",
|
||||
},
|
||||
},
|
||||
},
|
||||
Env: []string{
|
||||
"TEST_A_SECRET=x",
|
||||
"TEST_A_USERNAME=u2",
|
||||
@ -397,7 +390,7 @@ func TestUpload(t *testing.T) {
|
||||
TrustedCerts: cert(s),
|
||||
}
|
||||
},
|
||||
checks(check{"/blah/2.1.0/Linux/amd64/a.ubi", "u2", "x", content, map[string]string{}}),
|
||||
checks(check{"/blah/2.1.0/linux/amd64/a.ubi", "u2", "x", content, map[string]string{}}),
|
||||
},
|
||||
{
|
||||
"binary_with_ids", true, true, false, false,
|
||||
|
@ -78,9 +78,6 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
archive.NameTemplate = defaultBinaryNameTemplate
|
||||
}
|
||||
}
|
||||
if len(archive.Replacements) != 0 {
|
||||
deprecate.Notice(ctx, "archives.replacements")
|
||||
}
|
||||
ids.Inc(archive.ID)
|
||||
}
|
||||
return ids.Validate()
|
||||
@ -141,17 +138,19 @@ func checkArtifacts(artifacts map[string][]*artifact.Artifact) error {
|
||||
}
|
||||
|
||||
func createMeta(ctx *context.Context, arch config.Archive) error {
|
||||
return doCreate(ctx, arch, nil, arch.Format, tmpl.New(ctx))
|
||||
return doCreate(ctx, arch, nil, arch.Format)
|
||||
}
|
||||
|
||||
func create(ctx *context.Context, arch config.Archive, binaries []*artifact.Artifact) error {
|
||||
// nolint:staticcheck
|
||||
template := tmpl.New(ctx).WithArtifactReplacements(binaries[0], arch.Replacements)
|
||||
format := packageFormat(arch, binaries[0].Goos)
|
||||
return doCreate(ctx, arch, binaries, format, template)
|
||||
return doCreate(ctx, arch, binaries, format)
|
||||
}
|
||||
|
||||
func doCreate(ctx *context.Context, arch config.Archive, binaries []*artifact.Artifact, format string, template *tmpl.Template) error {
|
||||
func doCreate(ctx *context.Context, arch config.Archive, binaries []*artifact.Artifact, format string) error {
|
||||
template := tmpl.New(ctx)
|
||||
if len(binaries) > 0 {
|
||||
template = template.WithArtifact(binaries[0])
|
||||
}
|
||||
folder, err := template.Apply(arch.NameTemplate)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -253,10 +252,7 @@ func wrapFolder(a config.Archive) string {
|
||||
|
||||
func skip(ctx *context.Context, archive config.Archive, binaries []*artifact.Artifact) error {
|
||||
for _, binary := range binaries {
|
||||
// nolint:staticcheck
|
||||
name, err := tmpl.New(ctx).
|
||||
WithArtifactReplacements(binary, archive.Replacements).
|
||||
Apply(archive.NameTemplate)
|
||||
name, err := tmpl.New(ctx).WithArtifact(binary).Apply(archive.NameTemplate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -678,9 +678,6 @@ func TestRunPipeWrap(t *testing.T) {
|
||||
NameTemplate: "foo",
|
||||
WrapInDirectory: "foo_{{ .Os }}",
|
||||
Format: "tar.gz",
|
||||
Replacements: map[string]string{
|
||||
"darwin": "macOS",
|
||||
},
|
||||
Files: []config.File{
|
||||
{Source: "README.*"},
|
||||
},
|
||||
@ -704,11 +701,11 @@ func TestRunPipeWrap(t *testing.T) {
|
||||
|
||||
archives := ctx.Artifacts.Filter(artifact.ByType(artifact.UploadableArchive)).List()
|
||||
require.Len(t, archives, 1)
|
||||
require.Equal(t, "foo_macOS", artifact.ExtraOr(*archives[0], artifact.ExtraWrappedIn, ""))
|
||||
require.Equal(t, "foo_darwin", artifact.ExtraOr(*archives[0], artifact.ExtraWrappedIn, ""))
|
||||
|
||||
require.ElementsMatch(
|
||||
t,
|
||||
[]string{"foo_macOS/README.md", "foo_macOS/mybin"},
|
||||
[]string{"foo_darwin/README.md", "foo_darwin/mybin"},
|
||||
testlib.LsArchive(t, filepath.Join(dist, "foo.tar.gz"), "tar.gz"),
|
||||
)
|
||||
}
|
||||
|
@ -59,14 +59,6 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if fpm.Maintainer == "" {
|
||||
deprecate.NoticeCustom(ctx, "nfpms.maintainer", "`{{ .Property }}` should always be set, check {{ .URL }} for more info")
|
||||
}
|
||||
if len(fpm.Replacements) != 0 {
|
||||
deprecate.Notice(ctx, "nfpms.replacements")
|
||||
}
|
||||
for _, rfpm := range fpm.Overrides {
|
||||
if len(rfpm.Replacements) != 0 {
|
||||
deprecate.Notice(ctx, "nfpms.replacements")
|
||||
}
|
||||
}
|
||||
ids.Inc(fpm.ID)
|
||||
}
|
||||
|
||||
@ -184,9 +176,8 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar
|
||||
return err
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
t := tmpl.New(ctx).
|
||||
WithArtifactReplacements(binaries[0], overridden.Replacements).
|
||||
WithArtifact(binaries[0]).
|
||||
WithExtraFields(tmpl.Fields{
|
||||
"Release": fpm.Release,
|
||||
"Epoch": fpm.Epoch,
|
||||
|
@ -33,42 +33,6 @@ func TestRunPipeNoFormats(t *testing.T) {
|
||||
testlib.AssertSkipped(t, Pipe{}.Run(ctx))
|
||||
}
|
||||
|
||||
func TestDefaultsDeprecated(t *testing.T) {
|
||||
t.Run("replacements", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
NFPMs: []config.NFPM{
|
||||
{
|
||||
NFPMOverridables: config.NFPMOverridables{
|
||||
Replacements: map[string]string{
|
||||
"linux": "Tux",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.NoError(t, Pipe{}.Default(ctx))
|
||||
require.True(t, ctx.Deprecated)
|
||||
})
|
||||
|
||||
t.Run("replacements overrides", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
NFPMs: []config.NFPM{
|
||||
{
|
||||
Overrides: map[string]config.NFPMOverridables{
|
||||
"apk": {
|
||||
Replacements: map[string]string{
|
||||
"linux": "Tux",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.NoError(t, Pipe{}.Default(ctx))
|
||||
require.True(t, ctx.Deprecated)
|
||||
})
|
||||
}
|
||||
|
||||
func TestRunPipeError(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Dist: t.TempDir(),
|
||||
@ -206,9 +170,6 @@ func TestRunPipe(t *testing.T) {
|
||||
Destination: "/etc/folder",
|
||||
},
|
||||
},
|
||||
Replacements: map[string]string{
|
||||
"linux": "Tux",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -304,7 +265,7 @@ func TestRunPipe(t *testing.T) {
|
||||
}
|
||||
|
||||
if pkg.Goos == "linux" {
|
||||
require.Equal(t, "foo_1.0.0_Tux_"+arch+"-10-20"+ext, pkg.Name)
|
||||
require.Equal(t, "foo_1.0.0_linux_"+arch+"-10-20"+ext, pkg.Name)
|
||||
} else {
|
||||
require.Equal(t, "foo_1.0.0_ios_arm64-10-20"+ext, pkg.Name)
|
||||
}
|
||||
@ -1256,9 +1217,6 @@ func TestMeta(t *testing.T) {
|
||||
Type: "dir",
|
||||
},
|
||||
},
|
||||
Replacements: map[string]string{
|
||||
"linux": "Tux",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1283,7 +1241,7 @@ func TestMeta(t *testing.T) {
|
||||
for _, pkg := range packages {
|
||||
format := pkg.Format()
|
||||
require.NotEmpty(t, format)
|
||||
require.Equal(t, pkg.Name, "foo_1.0.0_Tux_"+pkg.Goarch+"-10-20."+format)
|
||||
require.Equal(t, pkg.Name, "foo_1.0.0_linux_"+pkg.Goarch+"-10-20."+format)
|
||||
require.Equal(t, pkg.ID(), "someid")
|
||||
require.ElementsMatch(t, []string{
|
||||
"/var/log/foobar",
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
|
||||
"github.com/caarlos0/log"
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/deprecate"
|
||||
"github.com/goreleaser/goreleaser/internal/gio"
|
||||
"github.com/goreleaser/goreleaser/internal/ids"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||
@ -132,9 +131,6 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
snap.Builds = append(snap.Builds, b.ID)
|
||||
}
|
||||
}
|
||||
if len(snap.Replacements) != 0 {
|
||||
deprecate.Notice(ctx, "snapcrafts.replacements")
|
||||
}
|
||||
ids.Inc(snap.ID)
|
||||
}
|
||||
return ids.Validate()
|
||||
@ -224,10 +220,7 @@ func (Pipe) Publish(ctx *context.Context) error {
|
||||
|
||||
func create(ctx *context.Context, snap config.Snapcraft, arch string, binaries []*artifact.Artifact) error {
|
||||
log := log.WithField("arch", arch)
|
||||
// nolint:staticcheck
|
||||
folder, err := tmpl.New(ctx).
|
||||
WithArtifactReplacements(binaries[0], snap.Replacements).
|
||||
Apply(snap.NameTemplate)
|
||||
folder, err := tmpl.New(ctx).WithArtifact(binaries[0]).Apply(snap.NameTemplate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -156,22 +156,6 @@ func (t *Template) WithExtraFields(f Fields) *Template {
|
||||
return t
|
||||
}
|
||||
|
||||
// WithArtifactReplacements populates Fields from the artifact and replacements.
|
||||
//
|
||||
// Deprecated: use WithArtifact instead.
|
||||
func (t *Template) WithArtifactReplacements(a *artifact.Artifact, replacements map[string]string) *Template {
|
||||
t.fields[osKey] = replace(replacements, a.Goos)
|
||||
t.fields[arch] = replace(replacements, a.Goarch)
|
||||
t.fields[arm] = replace(replacements, a.Goarm)
|
||||
t.fields[mips] = replace(replacements, a.Gomips)
|
||||
t.fields[amd64] = replace(replacements, a.Goamd64)
|
||||
t.fields[binary] = artifact.ExtraOr(*a, binary, t.fields[projectName].(string))
|
||||
t.fields[artifactName] = a.Name
|
||||
t.fields[artifactExt] = artifact.ExtraOr(*a, artifact.ExtraExt, "")
|
||||
t.fields[artifactPath] = a.Path
|
||||
return t
|
||||
}
|
||||
|
||||
// WithArtifact populates Fields from the artifact.
|
||||
func (t *Template) WithArtifact(a *artifact.Artifact) *Template {
|
||||
t.fields[osKey] = a.Goos
|
||||
@ -280,15 +264,6 @@ func (t *Template) ApplySingleEnvOnly(s string) (string, error) {
|
||||
return out.String(), err
|
||||
}
|
||||
|
||||
// deprecated: will be removed soon.
|
||||
func replace(replacements map[string]string, original string) string {
|
||||
result := replacements[original]
|
||||
if result == "" {
|
||||
return original
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func incMajor(v string) string {
|
||||
return prefix(v) + semver.MustParse(v).IncMajor().String()
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func TestWithArtifact(t *testing.T) {
|
||||
)
|
||||
for expect, tmpl := range map[string]string{
|
||||
"bar": "{{.Env.FOO}}",
|
||||
"Linux": "{{.Os}}",
|
||||
"linux": "{{.Os}}",
|
||||
"amd64": "{{.Arch}}",
|
||||
"6": "{{.Arm}}",
|
||||
"softfloat": "{{.Mips}}",
|
||||
@ -99,7 +99,7 @@ func TestWithArtifact(t *testing.T) {
|
||||
expect := expect
|
||||
t.Run(expect, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, err := New(ctx).WithArtifactReplacements(
|
||||
result, err := New(ctx).WithArtifact(
|
||||
&artifact.Artifact{
|
||||
Name: "not-this-binary",
|
||||
Path: "/tmp/foo.exe",
|
||||
@ -113,7 +113,6 @@ func TestWithArtifact(t *testing.T) {
|
||||
artifact.ExtraExt: ".exe",
|
||||
},
|
||||
},
|
||||
map[string]string{"linux": "Linux"},
|
||||
).Apply(tmpl)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expect, result)
|
||||
@ -122,13 +121,13 @@ func TestWithArtifact(t *testing.T) {
|
||||
|
||||
t.Run("artifact without binary name", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, err := New(ctx).WithArtifactReplacements(
|
||||
result, err := New(ctx).WithArtifact(
|
||||
&artifact.Artifact{
|
||||
Name: "another-binary",
|
||||
Goarch: "amd64",
|
||||
Goos: "linux",
|
||||
Goarm: "6",
|
||||
}, map[string]string{},
|
||||
},
|
||||
).Apply("{{ .Binary }}")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, ctx.Config.ProjectName, result)
|
||||
|
@ -596,19 +596,18 @@ type UPX struct {
|
||||
|
||||
// Archive config used for the archive.
|
||||
type Archive struct {
|
||||
ID string `yaml:"id,omitempty" json:"id,omitempty"`
|
||||
Builds []string `yaml:"builds,omitempty" json:"builds,omitempty"`
|
||||
BuildsInfo FileInfo `yaml:"builds_info,omitempty" json:"builds_info,omitempty"`
|
||||
NameTemplate string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
|
||||
Replacements map[string]string `yaml:"replacements,omitempty" json:"replacements,omitempty"` // Deprecated: use templates instead
|
||||
Format string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=tar,enum=tgz,enum=tar.gz,enum=zip,enum=gz,enum=tar.xz,enum=txz,enum=binary,default=tar.gz"`
|
||||
FormatOverrides []FormatOverride `yaml:"format_overrides,omitempty" json:"format_overrides,omitempty"`
|
||||
WrapInDirectory string `yaml:"wrap_in_directory,omitempty" json:"wrap_in_directory,omitempty" jsonschema:"oneof_type=string;boolean"`
|
||||
StripParentBinaryFolder bool `yaml:"strip_parent_binary_folder,omitempty" json:"strip_parent_binary_folder,omitempty"`
|
||||
RLCP bool `yaml:"rlcp,omitempty" json:"rlcp,omitempty"`
|
||||
Files []File `yaml:"files,omitempty" json:"files,omitempty"`
|
||||
Meta bool `yaml:"meta,omitempty" json:"meta,omitempty"`
|
||||
AllowDifferentBinaryCount bool `yaml:"allow_different_binary_count,omitempty" json:"allow_different_binary_count,omitempty"`
|
||||
ID string `yaml:"id,omitempty" json:"id,omitempty"`
|
||||
Builds []string `yaml:"builds,omitempty" json:"builds,omitempty"`
|
||||
BuildsInfo FileInfo `yaml:"builds_info,omitempty" json:"builds_info,omitempty"`
|
||||
NameTemplate string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
|
||||
Format string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=tar,enum=tgz,enum=tar.gz,enum=zip,enum=gz,enum=tar.xz,enum=txz,enum=binary,default=tar.gz"`
|
||||
FormatOverrides []FormatOverride `yaml:"format_overrides,omitempty" json:"format_overrides,omitempty"`
|
||||
WrapInDirectory string `yaml:"wrap_in_directory,omitempty" json:"wrap_in_directory,omitempty" jsonschema:"oneof_type=string;boolean"`
|
||||
StripParentBinaryFolder bool `yaml:"strip_parent_binary_folder,omitempty" json:"strip_parent_binary_folder,omitempty"`
|
||||
RLCP bool `yaml:"rlcp,omitempty" json:"rlcp,omitempty"`
|
||||
Files []File `yaml:"files,omitempty" json:"files,omitempty"`
|
||||
Meta bool `yaml:"meta,omitempty" json:"meta,omitempty"`
|
||||
AllowDifferentBinaryCount bool `yaml:"allow_different_binary_count,omitempty" json:"allow_different_binary_count,omitempty"`
|
||||
}
|
||||
|
||||
type ReleaseNotesMode string
|
||||
@ -773,25 +772,24 @@ type NFPMArchLinux struct {
|
||||
|
||||
// NFPMOverridables is used to specify per package format settings.
|
||||
type NFPMOverridables struct {
|
||||
FileNameTemplate string `yaml:"file_name_template,omitempty" json:"file_name_template,omitempty"`
|
||||
PackageName string `yaml:"package_name,omitempty" json:"package_name,omitempty"`
|
||||
Epoch string `yaml:"epoch,omitempty" json:"epoch,omitempty"`
|
||||
Release string `yaml:"release,omitempty" json:"release,omitempty"`
|
||||
Prerelease string `yaml:"prerelease,omitempty" json:"prerelease,omitempty"`
|
||||
VersionMetadata string `yaml:"version_metadata,omitempty" json:"version_metadata,omitempty"`
|
||||
Replacements map[string]string `yaml:"replacements,omitempty" json:"replacements,omitempty"` // Deprecated: use templates instead
|
||||
Dependencies []string `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
|
||||
Recommends []string `yaml:"recommends,omitempty" json:"recommends,omitempty"`
|
||||
Suggests []string `yaml:"suggests,omitempty" json:"suggests,omitempty"`
|
||||
Conflicts []string `yaml:"conflicts,omitempty" json:"conflicts,omitempty"`
|
||||
Replaces []string `yaml:"replaces,omitempty" json:"replaces,omitempty"`
|
||||
Provides []string `yaml:"provides,omitempty" json:"provides,omitempty"`
|
||||
Contents files.Contents `yaml:"contents,omitempty" json:"contents,omitempty"`
|
||||
Scripts NFPMScripts `yaml:"scripts,omitempty" json:"scripts,omitempty"`
|
||||
RPM NFPMRPM `yaml:"rpm,omitempty" json:"rpm,omitempty"`
|
||||
Deb NFPMDeb `yaml:"deb,omitempty" json:"deb,omitempty"`
|
||||
APK NFPMAPK `yaml:"apk,omitempty" json:"apk,omitempty"`
|
||||
ArchLinux NFPMArchLinux `yaml:"archlinux,omitempty" json:"archlinux,omitempty"`
|
||||
FileNameTemplate string `yaml:"file_name_template,omitempty" json:"file_name_template,omitempty"`
|
||||
PackageName string `yaml:"package_name,omitempty" json:"package_name,omitempty"`
|
||||
Epoch string `yaml:"epoch,omitempty" json:"epoch,omitempty"`
|
||||
Release string `yaml:"release,omitempty" json:"release,omitempty"`
|
||||
Prerelease string `yaml:"prerelease,omitempty" json:"prerelease,omitempty"`
|
||||
VersionMetadata string `yaml:"version_metadata,omitempty" json:"version_metadata,omitempty"`
|
||||
Dependencies []string `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
|
||||
Recommends []string `yaml:"recommends,omitempty" json:"recommends,omitempty"`
|
||||
Suggests []string `yaml:"suggests,omitempty" json:"suggests,omitempty"`
|
||||
Conflicts []string `yaml:"conflicts,omitempty" json:"conflicts,omitempty"`
|
||||
Replaces []string `yaml:"replaces,omitempty" json:"replaces,omitempty"`
|
||||
Provides []string `yaml:"provides,omitempty" json:"provides,omitempty"`
|
||||
Contents files.Contents `yaml:"contents,omitempty" json:"contents,omitempty"`
|
||||
Scripts NFPMScripts `yaml:"scripts,omitempty" json:"scripts,omitempty"`
|
||||
RPM NFPMRPM `yaml:"rpm,omitempty" json:"rpm,omitempty"`
|
||||
Deb NFPMDeb `yaml:"deb,omitempty" json:"deb,omitempty"`
|
||||
APK NFPMAPK `yaml:"apk,omitempty" json:"apk,omitempty"`
|
||||
ArchLinux NFPMArchLinux `yaml:"archlinux,omitempty" json:"archlinux,omitempty"`
|
||||
}
|
||||
|
||||
// SBOM config.
|
||||
@ -865,10 +863,8 @@ type SnapcraftLayoutMetadata struct {
|
||||
|
||||
// Snapcraft config.
|
||||
type Snapcraft struct {
|
||||
NameTemplate string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
|
||||
Replacements map[string]string `yaml:"replacements,omitempty" json:"replacements,omitempty"` // Deprecated: use templates instead.
|
||||
Publish bool `yaml:"publish,omitempty" json:"publish,omitempty"`
|
||||
|
||||
NameTemplate string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
|
||||
Publish bool `yaml:"publish,omitempty" json:"publish,omitempty"`
|
||||
ID string `yaml:"id,omitempty" json:"id,omitempty"`
|
||||
Builds []string `yaml:"builds,omitempty" json:"builds,omitempty"`
|
||||
Name string `yaml:"name,omitempty" json:"name,omitempty"`
|
||||
|
@ -98,18 +98,16 @@ may have some extra fields:
|
||||
|
||||
| Key | Description |
|
||||
| --------------- | -------------------------------------------- |
|
||||
| `.Os` | `GOOS`[^archive-replacementes] |
|
||||
| `.Arch` | `GOARCH`[^archive-replacementes] |
|
||||
| `.Arm` | `GOARM`[^archive-replacementes] |
|
||||
| `.Mips` | `GOMIPS`[^archive-replacementes] |
|
||||
| `.Amd64` | `GOAMD64`[^archive-replacementes] |
|
||||
| `.Os` | `GOOS` |
|
||||
| `.Arch` | `GOARCH` |
|
||||
| `.Arm` | `GOARM` |
|
||||
| `.Mips` | `GOMIPS` |
|
||||
| `.Amd64` | `GOAMD64` |
|
||||
| `.Binary` | binary name |
|
||||
| `.ArtifactName` | archive name |
|
||||
| `.ArtifactPath` | absolute path to artifact |
|
||||
| `.ArtifactExt` | binary extension (e.g. `.exe`). Since v1.11. |
|
||||
|
||||
[^archive-replacementes]: Might have been replaced by `archives.replacements`.
|
||||
|
||||
## nFPM extra fields
|
||||
|
||||
In the nFPM name template field, you can use those extra fields:
|
||||
|
@ -190,9 +190,33 @@ Same as [`archives.rlcp`](#archivesrlcp).
|
||||
rlcp: true
|
||||
```
|
||||
|
||||
### nfpms.maintainer
|
||||
|
||||
> since 2022-05-07 (v1.9.0)
|
||||
|
||||
nFPM will soon make mandatory setting the maintainer field.
|
||||
|
||||
=== "Before"
|
||||
|
||||
```yaml
|
||||
nfpms:
|
||||
- maintainer: ''
|
||||
```
|
||||
|
||||
=== "After"
|
||||
|
||||
```yaml
|
||||
nfpms:
|
||||
- maintainer: 'Name <email>'
|
||||
```
|
||||
|
||||
## Expired deprecation notices
|
||||
|
||||
The following options were deprecated in the past and were already removed.
|
||||
|
||||
### archives.replacements
|
||||
|
||||
> since 2022-11-24 (v1.14.0)
|
||||
> since 2022-11-24 (v1.14.0), removed 2023-06-06 (v1.19.0)
|
||||
|
||||
The `replacements` will be removed soon from the archives section, as it was
|
||||
never handled correctly when multiple archives were being used, and it also
|
||||
@ -234,7 +258,7 @@ Notice that if you are using the `archives.name_template`, notice it also has a
|
||||
|
||||
### nfpms.replacements
|
||||
|
||||
> since 2022-11-24 (v1.14.0)
|
||||
> since 2022-11-24 (v1.14.0), removed 2023-06-06 (v1.19.0)
|
||||
|
||||
The `replacements` will be removed soon from the nFPMs section.
|
||||
|
||||
@ -274,7 +298,7 @@ instead of custom templates.
|
||||
|
||||
### snapcrafts.replacements
|
||||
|
||||
> since 2022-11-24 (v1.14.0)
|
||||
> since 2022-11-24 (v1.14.0), removed 2023-06-06 (v1.19.0)
|
||||
|
||||
The `replacements` will be removed soon from the Snapcrafts section.
|
||||
|
||||
@ -312,30 +336,6 @@ Those two configurations will yield the same results.
|
||||
Generally speaking, is probably best to use `{{ .ConventionalFileName }}`
|
||||
instead of custom templates.
|
||||
|
||||
### nfpms.maintainer
|
||||
|
||||
> since 2022-05-07 (v1.9.0)
|
||||
|
||||
nFPM will soon make mandatory setting the maintainer field.
|
||||
|
||||
=== "Before"
|
||||
|
||||
```yaml
|
||||
nfpms:
|
||||
- maintainer: ''
|
||||
```
|
||||
|
||||
=== "After"
|
||||
|
||||
```yaml
|
||||
nfpms:
|
||||
- maintainer: 'Name <email>'
|
||||
```
|
||||
|
||||
## Expired deprecation notices
|
||||
|
||||
The following options were deprecated in the past and were already removed.
|
||||
|
||||
### variables
|
||||
|
||||
> since 2022-01-20 (v1.4.0), removed 2023-05-01 (v1.18.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user