1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-26 04:22:05 +02:00

29 lines
633 B
Go
Raw Normal View History

package effectiveconfig
import (
"os"
"path/filepath"
"github.com/caarlos0/log"
"github.com/goreleaser/goreleaser/internal/yaml"
"github.com/goreleaser/goreleaser/pkg/context"
)
// Pipe that writes the effective config file to dist.
type Pipe struct{}
func (Pipe) String() string {
return "writing effective config file"
}
// Run the pipe.
func (Pipe) Run(ctx *context.Context) (err error) {
path := filepath.Join(ctx.Config.Dist, "config.yaml")
bts, err := yaml.Marshal(ctx.Config)
if err != nil {
return err
}
2017-12-18 21:07:47 -02:00
log.WithField("config", path).Info("writing")
return os.WriteFile(path, bts, 0o644) //nolint: gosec
}