You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-11-06 09:09:29 +02:00
feat: consistently use directory in property names (#4737)
It was a mess of "folder" x "directory", so changed it all to "directory". Closes #4732
This commit is contained in:
committed by
GitHub
parent
5a8b6d41fb
commit
7fc93995b8
@@ -59,6 +59,10 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if archive.ID == "" {
|
||||
archive.ID = "default"
|
||||
}
|
||||
if archive.StripParentBinaryFolder {
|
||||
archive.StripBinaryDirectory = true
|
||||
deprecate.Notice(ctx, "archives.strip_parent_binary_folder")
|
||||
}
|
||||
if archive.RLCP != "" && archive.Format != "binary" && len(archive.Files) > 0 {
|
||||
deprecate.Notice(ctx, "archives.rlcp")
|
||||
}
|
||||
@@ -202,7 +206,7 @@ func create(ctx *context.Context, arch config.Archive, binaries []*artifact.Arti
|
||||
bins := []string{}
|
||||
for _, binary := range binaries {
|
||||
dst := binary.Name
|
||||
if arch.StripParentBinaryFolder {
|
||||
if arch.StripBinaryDirectory {
|
||||
dst = filepath.Base(dst)
|
||||
}
|
||||
if err := a.Add(config.File{
|
||||
|
||||
@@ -88,8 +88,8 @@ func TestRunPipe(t *testing.T) {
|
||||
Owner: "root",
|
||||
Group: "root",
|
||||
},
|
||||
NameTemplate: defaultNameTemplate,
|
||||
StripParentBinaryFolder: dets.Strip,
|
||||
NameTemplate: defaultNameTemplate,
|
||||
StripBinaryDirectory: dets.Strip,
|
||||
Files: []config.File{
|
||||
{Source: "README.{{.Os}}.*"},
|
||||
{Source: "./foo/**/*"},
|
||||
|
||||
@@ -26,8 +26,12 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if blob.Bucket == "" || blob.Provider == "" {
|
||||
return fmt.Errorf("bucket or provider cannot be empty")
|
||||
}
|
||||
if blob.Folder == "" {
|
||||
blob.Folder = "{{ .ProjectName }}/{{ .Tag }}"
|
||||
if blob.Folder != "" {
|
||||
deprecate.Notice(ctx, "blobs.folder")
|
||||
blob.Directory = blob.Folder
|
||||
}
|
||||
if blob.Directory == "" {
|
||||
blob.Directory = "{{ .ProjectName }}/{{ .Tag }}"
|
||||
}
|
||||
if blob.ContentDisposition == "" {
|
||||
blob.ContentDisposition = "attachment;filename={{.Filename}}"
|
||||
|
||||
@@ -92,20 +92,21 @@ func TestDefaults(t *testing.T) {
|
||||
{
|
||||
Bucket: "foo",
|
||||
Provider: "azblob",
|
||||
Folder: "{{ .ProjectName }}/{{ .Tag }}",
|
||||
Directory: "{{ .ProjectName }}/{{ .Tag }}",
|
||||
IDs: []string{"foo", "bar"},
|
||||
ContentDisposition: "inline",
|
||||
},
|
||||
{
|
||||
Bucket: "foobar",
|
||||
Provider: "gcs",
|
||||
Folder: "{{ .ProjectName }}/{{ .Tag }}",
|
||||
Directory: "{{ .ProjectName }}/{{ .Tag }}",
|
||||
ContentDisposition: "attachment;filename={{.Filename}}",
|
||||
},
|
||||
{
|
||||
Bucket: "deprecated",
|
||||
Provider: "s3",
|
||||
Folder: "static",
|
||||
Directory: "static",
|
||||
OldDisableSSL: true,
|
||||
DisableSSL: true,
|
||||
OldKMSKey: "fake",
|
||||
|
||||
@@ -85,11 +85,11 @@ func urlFor(ctx *context.Context, conf config.Blob) (string, error) {
|
||||
// upload to destination (eg: gs://gorelease-bucket) using the given uploader
|
||||
// implementation.
|
||||
func doUpload(ctx *context.Context, conf config.Blob) error {
|
||||
folder, err := tmpl.New(ctx).Apply(conf.Folder)
|
||||
dir, err := tmpl.New(ctx).Apply(conf.Directory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
folder = strings.TrimPrefix(folder, "/")
|
||||
dir = strings.TrimPrefix(dir, "/")
|
||||
|
||||
bucketURL, err := urlFor(ctx, conf)
|
||||
if err != nil {
|
||||
@@ -141,7 +141,7 @@ func doUpload(ctx *context.Context, conf config.Blob) error {
|
||||
g.Go(func() error {
|
||||
// TODO: replace this with ?prefix=folder on the bucket url
|
||||
dataFile := artifact.Path
|
||||
uploadFile := path.Join(folder, artifact.Name)
|
||||
uploadFile := path.Join(dir, artifact.Name)
|
||||
|
||||
return uploadData(ctx, conf, up, dataFile, uploadFile, bucketURL)
|
||||
})
|
||||
@@ -155,7 +155,7 @@ func doUpload(ctx *context.Context, conf config.Blob) error {
|
||||
name := name
|
||||
fullpath := fullpath
|
||||
g.Go(func() error {
|
||||
uploadFile := path.Join(folder, name)
|
||||
uploadFile := path.Join(dir, name)
|
||||
return uploadData(ctx, conf, up, fullpath, uploadFile, bucketURL)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -74,6 +74,10 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if brew.Plist != "" {
|
||||
deprecate.Notice(ctx, "brews.plist")
|
||||
}
|
||||
if brew.Folder != "" {
|
||||
deprecate.Notice(ctx, "brews.folder")
|
||||
brew.Directory = brew.Folder
|
||||
}
|
||||
if !reflect.DeepEqual(brew.Tap, config.RepoRef{}) {
|
||||
brew.Repository = brew.Tap
|
||||
deprecate.Notice(ctx, "brews.tap")
|
||||
@@ -144,7 +148,7 @@ func doPublish(ctx *context.Context, formula *artifact.Artifact, cl client.Clien
|
||||
|
||||
repo := client.RepoFromRef(brew.Repository)
|
||||
|
||||
gpath := buildFormulaPath(brew.Folder, formula.Name)
|
||||
gpath := buildFormulaPath(brew.Directory, formula.Name)
|
||||
|
||||
msg, err := tmpl.New(ctx).Apply(brew.CommitMessageTemplate)
|
||||
if err != nil {
|
||||
@@ -271,7 +275,7 @@ func doRun(ctx *context.Context, brew config.Homebrew, cl client.ReleaseURLTempl
|
||||
}
|
||||
|
||||
filename := brew.Name + ".rb"
|
||||
path := filepath.Join(ctx.Config.Dist, "homebrew", brew.Folder, filename)
|
||||
path := filepath.Join(ctx.Config.Dist, "homebrew", brew.Directory, filename)
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
4
internal/pipe/dist/dist.go
vendored
4
internal/pipe/dist/dist.go
vendored
@@ -1,4 +1,4 @@
|
||||
// Package dist provides checks to make sure the dist folder is always
|
||||
// Package dist provides checks to make sure the dist directory is always
|
||||
// empty.
|
||||
package dist
|
||||
|
||||
@@ -21,7 +21,7 @@ func (Pipe) String() string {
|
||||
func (Pipe) Run(ctx *context.Context) (err error) {
|
||||
_, err = os.Stat(ctx.Config.Dist)
|
||||
if os.IsNotExist(err) {
|
||||
log.Debugf("%s doesn't exist, creating empty folder", ctx.Config.Dist)
|
||||
log.Debugf("%s doesn't exist, creating empty directory", ctx.Config.Dist)
|
||||
return mkdir(ctx)
|
||||
}
|
||||
if ctx.Clean {
|
||||
|
||||
@@ -97,6 +97,10 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if scoop.Name == "" {
|
||||
scoop.Name = ctx.Config.ProjectName
|
||||
}
|
||||
if scoop.Folder != "" {
|
||||
deprecate.Notice(ctx, "scoops.folder")
|
||||
scoop.Directory = scoop.Folder
|
||||
}
|
||||
scoop.CommitAuthor = commitauthor.Default(scoop.CommitAuthor)
|
||||
if scoop.CommitMessageTemplate == "" {
|
||||
scoop.CommitMessageTemplate = "Scoop update for {{ .ProjectName }} version {{ .Tag }}"
|
||||
@@ -180,7 +184,7 @@ func doRun(ctx *context.Context, scoop config.Scoop, cl client.ReleaseURLTemplat
|
||||
}
|
||||
|
||||
filename := scoop.Name + ".json"
|
||||
path := filepath.Join(ctx.Config.Dist, "scoop", scoop.Folder, filename)
|
||||
path := filepath.Join(ctx.Config.Dist, "scoop", scoop.Directory, filename)
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -247,7 +251,7 @@ func doPublish(ctx *context.Context, manifest *artifact.Artifact, cl client.Clie
|
||||
}
|
||||
|
||||
repo := client.RepoFromRef(scoop.Repository)
|
||||
gpath := path.Join(scoop.Folder, manifest.Name)
|
||||
gpath := path.Join(scoop.Directory, manifest.Name)
|
||||
|
||||
if scoop.Repository.Git.URL != "" {
|
||||
return client.NewGitUploadClient(repo.Branch).
|
||||
|
||||
Reference in New Issue
Block a user