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:
parent
b34224ab36
commit
8877c72abc
@ -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)
|
||||
}
|
||||
|
@ -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(
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user