github.1git.de/goreleaser/goreleaser@v0.92.0/internal/pipe/effectiveconfig/config.go (about)

     1  package effectiveconfig
     2  
     3  import (
     4  	"io/ioutil"
     5  	"path/filepath"
     6  
     7  	"github.com/apex/log"
     8  	"github.com/goreleaser/goreleaser/pkg/context"
     9  	yaml "gopkg.in/yaml.v2"
    10  )
    11  
    12  // Pipe that writes the effective config file to dist
    13  type Pipe struct {
    14  }
    15  
    16  func (Pipe) String() string {
    17  	return "writing effective config file"
    18  }
    19  
    20  // Run the pipe
    21  func (Pipe) Run(ctx *context.Context) (err error) {
    22  	var path = filepath.Join(ctx.Config.Dist, "config.yaml")
    23  	bts, err := yaml.Marshal(ctx.Config)
    24  	if err != nil {
    25  		return err
    26  	}
    27  	log.WithField("config", path).Info("writing")
    28  	return ioutil.WriteFile(path, bts, 0644)
    29  }