mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-13 11:50:34 +02:00
fix(release): only change release draft status on new releases (#4744)
If we're editing an existing release, do not set it to draft. Closes #4742 Refs #4626
This commit is contained in:
parent
22b7daadb4
commit
053eccdba0
@ -417,13 +417,17 @@ func (c *githubClient) CreateRelease(ctx *context.Context, body string) (string,
|
||||
return strconv.FormatInt(release.GetID(), 10), nil
|
||||
}
|
||||
|
||||
func (c *githubClient) PublishRelease(ctx *context.Context, releaseID string) (err error) {
|
||||
func (c *githubClient) PublishRelease(ctx *context.Context, releaseID string) error {
|
||||
draft := ctx.Config.Release.Draft
|
||||
if draft {
|
||||
return nil
|
||||
}
|
||||
releaseIDInt, err := strconv.ParseInt(releaseID, 10, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("non-numeric release ID %q: %w", releaseID, err)
|
||||
}
|
||||
if _, err := c.updateRelease(ctx, releaseIDInt, &github.RepositoryRelease{
|
||||
Draft: github.Bool(ctx.Config.Release.Draft),
|
||||
Draft: github.Bool(draft),
|
||||
}); err != nil {
|
||||
return fmt.Errorf("could not update existing release: %w", err)
|
||||
}
|
||||
@ -454,6 +458,7 @@ func (c *githubClient) createOrUpdateRelease(ctx *context.Context, data *github.
|
||||
return release, err
|
||||
}
|
||||
|
||||
data.Draft = release.Draft
|
||||
data.Body = github.String(getReleaseNotes(release.GetBody(), body, ctx.Config.Release.ReleaseNotesMode))
|
||||
return c.updateRelease(ctx, release.GetID(), data)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user