mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
feat: create discussions from releases (#2177)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
57f7e44556
commit
7a7a6f61ba
2
go.mod
2
go.mod
@ -10,7 +10,7 @@ require (
|
||||
github.com/caarlos0/go-shellwords v1.0.12
|
||||
github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e
|
||||
github.com/fatih/color v1.10.0
|
||||
github.com/google/go-github/v28 v28.1.1
|
||||
github.com/google/go-github/v35 v35.0.1-0.20210421135231-b235769d1606
|
||||
github.com/goreleaser/fileglob v1.2.0
|
||||
github.com/goreleaser/nfpm/v2 v2.4.0
|
||||
github.com/imdario/mergo v0.3.12
|
||||
|
4
go.sum
4
go.sum
@ -274,8 +274,8 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-github/v28 v28.1.1 h1:kORf5ekX5qwXO2mGzXXOjMe/g6ap8ahVe0sBEulhSxo=
|
||||
github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM=
|
||||
github.com/google/go-github/v35 v35.0.1-0.20210421135231-b235769d1606 h1:+8mvMVu+3yXBi/HdWq39mWbt/60u9qS+dkVZfjqEnt8=
|
||||
github.com/google/go-github/v35 v35.0.1-0.20210421135231-b235769d1606/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs=
|
||||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/go-replayers/grpcreplay v1.0.0 h1:B5kVOzJ1hBgnevTgIWhSTatQ3608yu/2NnU0Ta1d0kY=
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/google/go-github/v28/github"
|
||||
"github.com/google/go-github/v35/github"
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||
"github.com/goreleaser/goreleaser/pkg/config"
|
||||
@ -60,7 +60,6 @@ func NewGitHub(ctx *context.Context, token string) (Client, error) {
|
||||
// CloseMilestone closes a given milestone.
|
||||
func (c *githubClient) CloseMilestone(ctx *context.Context, repo Repo, title string) error {
|
||||
milestone, err := c.getMilestoneByTitle(ctx, repo, title)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -139,12 +138,13 @@ func (c *githubClient) CreateRelease(ctx *context.Context, body string) (string,
|
||||
return "", err
|
||||
}
|
||||
|
||||
var data = &github.RepositoryRelease{
|
||||
Name: github.String(title),
|
||||
TagName: github.String(ctx.Git.CurrentTag),
|
||||
Body: github.String(body),
|
||||
Draft: github.Bool(ctx.Config.Release.Draft),
|
||||
Prerelease: github.Bool(ctx.PreRelease),
|
||||
data := &github.RepositoryRelease{
|
||||
Name: github.String(title),
|
||||
TagName: github.String(ctx.Git.CurrentTag),
|
||||
Body: github.String(body),
|
||||
Draft: github.Bool(ctx.Config.Release.Draft),
|
||||
Prerelease: github.Bool(ctx.PreRelease),
|
||||
DiscussionCategoryName: github.String(ctx.Config.Release.DiscussionCategoryName),
|
||||
}
|
||||
release, _, err = c.client.Repositories.GetReleaseByTag(
|
||||
ctx,
|
||||
@ -229,7 +229,6 @@ func (c *githubClient) getMilestoneByTitle(ctx *context.Context, repo Repo, titl
|
||||
repo.Name,
|
||||
opts,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -275,15 +275,16 @@ type Archive struct {
|
||||
|
||||
// Release config used for the GitHub/GitLab release.
|
||||
type Release struct {
|
||||
GitHub Repo `yaml:",omitempty"`
|
||||
GitLab Repo `yaml:",omitempty"`
|
||||
Gitea Repo `yaml:",omitempty"`
|
||||
Draft bool `yaml:",omitempty"`
|
||||
Disable bool `yaml:",omitempty"`
|
||||
Prerelease string `yaml:",omitempty"`
|
||||
NameTemplate string `yaml:"name_template,omitempty"`
|
||||
IDs []string `yaml:"ids,omitempty"`
|
||||
ExtraFiles []ExtraFile `yaml:"extra_files,omitempty"`
|
||||
GitHub Repo `yaml:",omitempty"`
|
||||
GitLab Repo `yaml:",omitempty"`
|
||||
Gitea Repo `yaml:",omitempty"`
|
||||
Draft bool `yaml:",omitempty"`
|
||||
Disable bool `yaml:",omitempty"`
|
||||
Prerelease string `yaml:",omitempty"`
|
||||
NameTemplate string `yaml:"name_template,omitempty"`
|
||||
IDs []string `yaml:"ids,omitempty"`
|
||||
ExtraFiles []ExtraFile `yaml:"extra_files,omitempty"`
|
||||
DiscussionCategoryName string `yaml:"discussion_category_name,omitempty"`
|
||||
}
|
||||
|
||||
// Milestone config used for VCS milestone.
|
||||
|
@ -28,6 +28,10 @@ release:
|
||||
# Default is false.
|
||||
draft: true
|
||||
|
||||
# If set, will create a release discussion in the category specified.
|
||||
# Default is empty.
|
||||
discussion_category_name: General
|
||||
|
||||
# If set to auto, will mark the release as not ready for production
|
||||
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
|
||||
# If set to true, will mark the release as not ready for production.
|
||||
|
Loading…
Reference in New Issue
Block a user