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

fix: improve "pushing" logs for multiple publishers

This commit is contained in:
Carlos Alexandro Becker
2023-05-19 14:10:06 +00:00
parent 779cce7af6
commit dfcd535e31
8 changed files with 28 additions and 13 deletions

View File

@ -37,7 +37,7 @@ func NewGitUploadClient(branch string) FileCreator {
}
}
// CreateFile implements FileCreator
// CreateFile implements FileCreator.
func (g *gitClient) CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo Repo, content []byte, path string, message string) error {
url, err := tmpl.New(ctx).Apply(repo.GitURL)
if err != nil {
@ -104,7 +104,12 @@ func (g *gitClient) CreateFile(ctx *context.Context, commitAuthor config.CommitA
return fmt.Errorf("failed to write %s: %w", path, err)
}
log.WithField("repo", url).WithField("name", repo.Name).Info("pushing")
log.
WithField("repository", url).
WithField("name", repo.Name).
WithField("file", path).
Info("pushing")
if err := runGitCmds(ctx, cwd, env, [][]string{
{"add", "-A", "."},
{"commit", "-m", message},

View File

@ -143,6 +143,12 @@ func (c *giteaClient) CreateFile(
},
}
log.
WithField("repository", repo.String()).
WithField("name", repo.Name).
WithField("name", repo.Name).
Info("pushing")
currentFile, resp, err := c.client.GetContents(repo.Owner, repo.Name, branch, path)
// file not exist, create it
if err != nil {

View File

@ -201,6 +201,12 @@ func (c *githubClient) CreateFile(
options.Branch = &branch
}
log.
WithField("repository", repo.String()).
WithField("name", repo.Name).
WithField("name", repo.Name).
Info("pushing")
if defBranch != branch && branch != "" {
_, res, err := c.client.Repositories.GetBranch(ctx, repo.Owner, repo.Name, branch, true)
if err != nil && (res == nil || res.StatusCode != 404) {

View File

@ -174,6 +174,12 @@ func (c *gitlabClient) CreateFile(
WithField("branch", branch).
Debug("projectID at brew")
log.
WithField("repository", repo.String()).
WithField("name", repo.Name).
WithField("name", repo.Name).
Info("pushing")
_, res, err := c.client.RepositoryFiles.GetFile(repo.String(), fileName, opts)
if err != nil && (res == nil || res.StatusCode != 404) {
log.

View File

@ -381,9 +381,7 @@ func doPublish(ctx *context.Context, pkgs []*artifact.Artifact) error {
Name: cfg.Name,
})
log.WithField("repo", cfg.GitURL).WithField("name", cfg.Name).Info("pushing")
for _, pkg := range pkgs {
log.WithField("package", pkg.Name).Info("pushing")
content, err := os.ReadFile(pkg.Path)
if err != nil {
return err

View File

@ -130,9 +130,6 @@ func doPublish(ctx *context.Context, formula *artifact.Artifact, cl client.Clien
repo := client.RepoFromRef(brew.Tap)
gpath := buildFormulaPath(brew.Folder, formula.Name)
log.WithField("formula", gpath).
WithField("repo", repo.String()).
Info("pushing")
msg, err := tmpl.New(ctx).Apply(brew.CommitMessageTemplate)
if err != nil {

View File

@ -312,11 +312,7 @@ func doPublish(ctx *context.Context, manifest *artifact.Artifact, cl client.Clie
}
cfg.Index = ref
repo := client.RepoFromRef(cfg.Index)
gpath := buildManifestPath(manifestsFolder, manifest.Name)
log.WithField("manifest", gpath).
WithField("repo", repo.String()).
Info("pushing")
msg, err := tmpl.New(ctx).Apply(cfg.CommitMessageTemplate)
if err != nil {

View File

@ -172,8 +172,9 @@ func doRun(ctx *context.Context, scoop config.Scoop, cl client.ReleaserURLTempla
}
func publishAll(ctx *context.Context, cli client.Client) error {
// even if one of them skips, we run them all, and then show return the skips all at once.
// this is needed so we actually create the `dist/foo.rb` file, which is useful for debugging.
// even if one of them skips, we run them all, and then show return the
// skips all at once. this is needed so we actually create the
// `dist/foo.json` file, which is useful for debugging.
skips := pipe.SkipMemento{}
for _, manifest := range ctx.Artifacts.Filter(artifact.ByType(artifact.ScoopManifest)).List() {
err := doPublish(ctx, manifest, cli)