mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
8d6ef40020
* chore(yaml): upgraded from yaml.v2 to yaml.v3 * provided internal package to take care of backward compatible settings: * UnmarshalStrict method * mute io.EOF unmarshaling errors * marshal indenting with 2 chars * adapted unit tests to new yaml v3 Signed-off-by: Frederic BIDON <fredbi@yahoo.com> * fixed failing tests Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
29 lines
629 B
Go
29 lines
629 B
Go
package effectiveconfig
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/apex/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
|
|
}
|
|
log.WithField("config", path).Info("writing")
|
|
return os.WriteFile(path, bts, 0o644) //nolint: gosec
|
|
}
|