Implement prerelease option
This commit is contained in:
parent
22db67489d
commit
6505d772c8
1
DOCS.md
1
DOCS.md
@ -11,6 +11,7 @@ The following parameters are used to configure the plugin:
|
|||||||
* **file_exists** - what to do if an file asset already exists, supported values: **overwrite** (default), **skip** and **fail**
|
* **file_exists** - what to do if an file asset already exists, supported values: **overwrite** (default), **skip** and **fail**
|
||||||
* **checksum** - checksum takes hash methods to include in your GitHub release for the files specified. Supported hash methods include md5, sha1, sha256, sha512, adler32, and crc32.
|
* **checksum** - checksum takes hash methods to include in your GitHub release for the files specified. Supported hash methods include md5, sha1, sha256, sha512, adler32, and crc32.
|
||||||
* **draft** - create a draft release if set to true
|
* **draft** - create a draft release if set to true
|
||||||
|
* **prerelease** - set the release as prerelease if set to true
|
||||||
* **base_url** - GitHub base URL, only required for GHE
|
* **base_url** - GitHub base URL, only required for GHE
|
||||||
* **upload_url** - GitHub upload URL, only required for GHE
|
* **upload_url** - GitHub upload URL, only required for GHE
|
||||||
|
|
||||||
|
6
main.go
6
main.go
@ -44,6 +44,11 @@ func main() {
|
|||||||
Usage: "create a draft release",
|
Usage: "create a draft release",
|
||||||
EnvVar: "PLUGIN_DRAFT,GITHUB_RELEASE_DRAFT",
|
EnvVar: "PLUGIN_DRAFT,GITHUB_RELEASE_DRAFT",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "prerelease",
|
||||||
|
Usage: "set the release as prerelease",
|
||||||
|
EnvVar: "PLUGIN_PRERELEASE,GITHUB_RELEASE_PRERELEASE",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "base-url",
|
Name: "base-url",
|
||||||
Value: "https://api.github.com/",
|
Value: "https://api.github.com/",
|
||||||
@ -112,6 +117,7 @@ func run(c *cli.Context) error {
|
|||||||
FileExists: c.String("file-exists"),
|
FileExists: c.String("file-exists"),
|
||||||
Checksum: c.StringSlice("checksum"),
|
Checksum: c.StringSlice("checksum"),
|
||||||
Draft: c.Bool("draft"),
|
Draft: c.Bool("draft"),
|
||||||
|
Prerelease: c.Bool("prerelease"),
|
||||||
BaseURL: c.String("base-url"),
|
BaseURL: c.String("base-url"),
|
||||||
UploadURL: c.String("upload-url"),
|
UploadURL: c.String("upload-url"),
|
||||||
},
|
},
|
||||||
|
@ -30,6 +30,7 @@ type (
|
|||||||
FileExists string
|
FileExists string
|
||||||
Checksum []string
|
Checksum []string
|
||||||
Draft bool
|
Draft bool
|
||||||
|
Prerelease bool
|
||||||
BaseURL string
|
BaseURL string
|
||||||
UploadURL string
|
UploadURL string
|
||||||
}
|
}
|
||||||
@ -117,6 +118,7 @@ func (p Plugin) Exec() error {
|
|||||||
Repo: p.Repo.Name,
|
Repo: p.Repo.Name,
|
||||||
Tag: filepath.Base(p.Commit.Ref),
|
Tag: filepath.Base(p.Commit.Ref),
|
||||||
Draft: p.Config.Draft,
|
Draft: p.Config.Draft,
|
||||||
|
Prerelease: p.Config.Prerelease,
|
||||||
FileExists: p.Config.FileExists,
|
FileExists: p.Config.FileExists,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ type releaseClient struct {
|
|||||||
Repo string
|
Repo string
|
||||||
Tag string
|
Tag string
|
||||||
Draft bool
|
Draft bool
|
||||||
|
Prerelease bool
|
||||||
FileExists string
|
FileExists string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,8 +52,9 @@ func (rc *releaseClient) getRelease() (*github.RepositoryRelease, error) {
|
|||||||
|
|
||||||
func (rc *releaseClient) newRelease() (*github.RepositoryRelease, error) {
|
func (rc *releaseClient) newRelease() (*github.RepositoryRelease, error) {
|
||||||
rr := &github.RepositoryRelease{
|
rr := &github.RepositoryRelease{
|
||||||
TagName: github.String(rc.Tag),
|
TagName: github.String(rc.Tag),
|
||||||
Draft: &rc.Draft,
|
Draft: &rc.Draft,
|
||||||
|
Prerelease: &rc.Prerelease,
|
||||||
}
|
}
|
||||||
|
|
||||||
release, _, err := rc.Client.Repositories.CreateRelease(rc.Owner, rc.Repo, rr)
|
release, _, err := rc.Client.Repositories.CreateRelease(rc.Owner, rc.Repo, rr)
|
||||||
|
Loading…
Reference in New Issue
Block a user