1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-01 13:07:49 +02:00

chore: better commit msgs for brew and scoop pipes (#605)

* style: moving commit msg to the pipe instead of the client

refs #604

* fix: better commit msg for scoop and brew
This commit is contained in:
Carlos Alexandro Becker 2018-03-10 14:13:00 -03:00 committed by GitHub
parent b34224ab36
commit 8877c72abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 9 deletions

View File

@ -19,6 +19,6 @@ type Info struct {
// Client interface
type Client interface {
CreateRelease(ctx *context.Context, body string) (releaseID int64, err error)
CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content bytes.Buffer, path string) (err error)
CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content bytes.Buffer, path, message string) (err error)
Upload(ctx *context.Context, releaseID int64, name string, file *os.File) (err error)
}

View File

@ -44,6 +44,7 @@ func (c *githubClient) CreateFile(
repo config.Repo,
content bytes.Buffer,
path string,
message string,
) error {
options := &github.RepositoryContentFileOptions{
Committer: &github.CommitAuthor{
@ -51,9 +52,7 @@ func (c *githubClient) CreateFile(
Email: github.String(commitAuthor.Email),
},
Content: content.Bytes(),
Message: github.String(
ctx.Config.ProjectName + " version " + ctx.Git.CurrentTag,
),
Message: github.String(message),
}
file, _, res, err := c.client.Repositories.GetContents(

View File

@ -136,7 +136,9 @@ func doRun(ctx *context.Context, client client.Client) error {
log.WithField("formula", path).
WithField("repo", ctx.Config.Brew.GitHub.String()).
Info("pushing")
return client.CreateFile(ctx, ctx.Config.Brew.CommitAuthor, ctx.Config.Brew.GitHub, content, path)
var msg = fmt.Sprintf("Brew formula update for %s version %s", ctx.Config.ProjectName, ctx.Git.CurrentTag)
return client.CreateFile(ctx, ctx.Config.Brew.CommitAuthor, ctx.Config.Brew.GitHub, content, path, msg)
}
func buildFormula(ctx *context.Context, client client.Client, artifact artifact.Artifact) (bytes.Buffer, error) {

View File

@ -403,7 +403,7 @@ func (client *DummyClient) CreateRelease(ctx *context.Context, body string) (rel
return
}
func (client *DummyClient) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content bytes.Buffer, path string) (err error) {
func (client *DummyClient) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content bytes.Buffer, path, msg string) (err error) {
client.CreatedFile = true
bts, _ := ioutil.ReadAll(&content)
client.Content = string(bts)

View File

@ -231,7 +231,7 @@ func (client *DummyClient) CreateRelease(ctx *context.Context, body string) (rel
return
}
func (client *DummyClient) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content bytes.Buffer, path string) (err error) {
func (client *DummyClient) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content bytes.Buffer, path, msg string) (err error) {
return
}

View File

@ -74,13 +74,13 @@ func doRun(ctx *context.Context, client client.Client) error {
if ctx.Config.Release.Draft {
return pipeline.Skip("release is marked as draft")
}
return client.CreateFile(
ctx,
ctx.Config.Scoop.CommitAuthor,
ctx.Config.Scoop.Bucket,
content,
path,
fmt.Sprintf("Scoop update for %s version %s", ctx.Config.ProjectName, ctx.Git.CurrentTag),
)
}

View File

@ -491,7 +491,7 @@ func (client *DummyClient) CreateRelease(ctx *context.Context, body string) (rel
return
}
func (client *DummyClient) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content bytes.Buffer, path string) (err error) {
func (client *DummyClient) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content bytes.Buffer, path, msg string) (err error) {
client.CreatedFile = true
bts, _ := ioutil.ReadAll(&content)
client.Content = string(bts)