mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-17 12:06:50 +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
|
// Client interface
|
||||||
type Client interface {
|
type Client interface {
|
||||||
CreateRelease(ctx *context.Context, body string) (releaseID int64, err error)
|
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)
|
Upload(ctx *context.Context, releaseID int64, name string, file *os.File) (err error)
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ func (c *githubClient) CreateFile(
|
|||||||
repo config.Repo,
|
repo config.Repo,
|
||||||
content bytes.Buffer,
|
content bytes.Buffer,
|
||||||
path string,
|
path string,
|
||||||
|
message string,
|
||||||
) error {
|
) error {
|
||||||
options := &github.RepositoryContentFileOptions{
|
options := &github.RepositoryContentFileOptions{
|
||||||
Committer: &github.CommitAuthor{
|
Committer: &github.CommitAuthor{
|
||||||
@ -51,9 +52,7 @@ func (c *githubClient) CreateFile(
|
|||||||
Email: github.String(commitAuthor.Email),
|
Email: github.String(commitAuthor.Email),
|
||||||
},
|
},
|
||||||
Content: content.Bytes(),
|
Content: content.Bytes(),
|
||||||
Message: github.String(
|
Message: github.String(message),
|
||||||
ctx.Config.ProjectName + " version " + ctx.Git.CurrentTag,
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file, _, res, err := c.client.Repositories.GetContents(
|
file, _, res, err := c.client.Repositories.GetContents(
|
||||||
|
@ -136,7 +136,9 @@ func doRun(ctx *context.Context, client client.Client) error {
|
|||||||
log.WithField("formula", path).
|
log.WithField("formula", path).
|
||||||
WithField("repo", ctx.Config.Brew.GitHub.String()).
|
WithField("repo", ctx.Config.Brew.GitHub.String()).
|
||||||
Info("pushing")
|
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) {
|
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
|
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
|
client.CreatedFile = true
|
||||||
bts, _ := ioutil.ReadAll(&content)
|
bts, _ := ioutil.ReadAll(&content)
|
||||||
client.Content = string(bts)
|
client.Content = string(bts)
|
||||||
|
@ -231,7 +231,7 @@ func (client *DummyClient) CreateRelease(ctx *context.Context, body string) (rel
|
|||||||
return
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,13 +74,13 @@ func doRun(ctx *context.Context, client client.Client) error {
|
|||||||
if ctx.Config.Release.Draft {
|
if ctx.Config.Release.Draft {
|
||||||
return pipeline.Skip("release is marked as draft")
|
return pipeline.Skip("release is marked as draft")
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.CreateFile(
|
return client.CreateFile(
|
||||||
ctx,
|
ctx,
|
||||||
ctx.Config.Scoop.CommitAuthor,
|
ctx.Config.Scoop.CommitAuthor,
|
||||||
ctx.Config.Scoop.Bucket,
|
ctx.Config.Scoop.Bucket,
|
||||||
content,
|
content,
|
||||||
path,
|
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
|
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
|
client.CreatedFile = true
|
||||||
bts, _ := ioutil.ReadAll(&content)
|
bts, _ := ioutil.ReadAll(&content)
|
||||||
client.Content = string(bts)
|
client.Content = string(bts)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user