mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-27 21:39:20 +02:00
<!-- Hi, thanks for contributing! Please make sure you read our CONTRIBUTING guide. Also, add tests and the respective documentation changes as well. --> <!-- If applied, this commit will... --> ... <!-- Why is this change being made? --> ... <!-- # Provide links to any relevant tickets, URLs or other resources --> ... --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
29 lines
639 B
Go
29 lines
639 B
Go
package effectiveconfig
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/caarlos0/log"
|
|
"github.com/goreleaser/goreleaser/v2/internal/yaml"
|
|
"github.com/goreleaser/goreleaser/v2/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
|
|
}
|