From 3f603279646949aebfb0a6f361909e7afb6655c4 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Tue, 16 Aug 2022 02:05:46 -0300 Subject: [PATCH] feat: nfpm changelog support (#3309) closes #3259 Signed-off-by: Carlos A Becker Signed-off-by: Carlos A Becker --- .goreleaser.yaml | 2 -- internal/pipe/nfpm/nfpm.go | 1 + internal/pipe/nfpm/nfpm_test.go | 1 + internal/pipe/nfpm/testdata/changelog.yaml | 23 ++++++++++++++++++++++ pkg/config/config.go | 1 + www/docs/customization/nfpm.md | 10 ++++++++++ 6 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 internal/pipe/nfpm/testdata/changelog.yaml diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6a65951479f..2fb6481e059 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -67,8 +67,6 @@ changelog: - title: Other work order: 9999 - - dockers: - image_templates: - 'goreleaser/goreleaser:{{ .Tag }}-amd64' diff --git a/internal/pipe/nfpm/nfpm.go b/internal/pipe/nfpm/nfpm.go index a2162d86659..c1e3f6eb0ea 100644 --- a/internal/pipe/nfpm/nfpm.go +++ b/internal/pipe/nfpm/nfpm.go @@ -252,6 +252,7 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar Vendor: fpm.Vendor, Homepage: homepage, License: fpm.License, + Changelog: fpm.Changelog, Overridables: nfpm.Overridables{ Conflicts: overridden.Conflicts, Depends: overridden.Dependencies, diff --git a/internal/pipe/nfpm/nfpm_test.go b/internal/pipe/nfpm/nfpm_test.go index 251527d7341..9cc22a24c4c 100644 --- a/internal/pipe/nfpm/nfpm_test.go +++ b/internal/pipe/nfpm/nfpm_test.go @@ -100,6 +100,7 @@ func TestRunPipe(t *testing.T) { Maintainer: "me@me", Vendor: "asdf", Homepage: "https://goreleaser.com/{{ .Env.PRO }}", + Changelog: "./testdata/changelog.yaml", NFPMOverridables: config.NFPMOverridables{ FileNameTemplate: defaultNameTemplate + "-{{ .Release }}-{{ .Epoch }}", PackageName: "foo", diff --git a/internal/pipe/nfpm/testdata/changelog.yaml b/internal/pipe/nfpm/testdata/changelog.yaml new file mode 100644 index 00000000000..06b076a29e0 --- /dev/null +++ b/internal/pipe/nfpm/testdata/changelog.yaml @@ -0,0 +1,23 @@ +- semver: 0.2.2 + date: 2022-08-15T23:28:59-03:00 + packager: GitHub + changes: + - commit: 4864bcced8ccc6b0428b237aa75e5c6b7e56fa69 + note: 'fix: force old version of go-git to avoid go-crypto issues' + author: + name: Carlos A Becker + email: caarlos0@users.noreply.github.com + committer: + name: Carlos A Becker + email: caarlos0@users.noreply.github.com + - commit: 1893f0b7a809699baf5138569de677a0a5de0445 + note: 'fix: old go-crypto version' + author: + name: Carlos A Becker + email: caarlos0@users.noreply.github.com + committer: + name: Carlos A Becker + email: caarlos0@users.noreply.github.com +- semver: 0.2.1 + date: 2022-08-15T22:44:59-03:00 + packager: GitHub diff --git a/pkg/config/config.go b/pkg/config/config.go index 5145e7469be..826958b12fe 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -543,6 +543,7 @@ type NFPM struct { Description string `yaml:"description,omitempty" json:"description,omitempty"` License string `yaml:"license,omitempty" json:"license,omitempty"` Bindir string `yaml:"bindir,omitempty" json:"bindir,omitempty"` + Changelog string `yaml:"changelog,omitempty" json:"changelog,omitempty"` Meta bool `yaml:"meta,omitempty" json:"meta,omitempty"` // make package without binaries - only deps } diff --git a/www/docs/customization/nfpm.md b/www/docs/customization/nfpm.md index 089cf9ac815..8200a07942e 100644 --- a/www/docs/customization/nfpm.md +++ b/www/docs/customization/nfpm.md @@ -126,6 +126,16 @@ nfpms: # Defaults to false. meta: true + # 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. + changelog: ./foo.yml + # Contents to add to the package. # GoReleaser will automatically add the binaries. contents: