mirror of
https://github.com/thegeeklab/wp-gitea-release.git
synced 2024-11-24 13:00:40 +00:00
Merge pull request #21 from tuxity/prerelease
Implement prerelease option
This commit is contained in:
commit
923189eb1a
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**
|
||||
* **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
|
||||
* **prerelease** - set the release as prerelease if set to true
|
||||
* **base_url** - GitHub base 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",
|
||||
EnvVar: "PLUGIN_DRAFT,GITHUB_RELEASE_DRAFT",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "prerelease",
|
||||
Usage: "set the release as prerelease",
|
||||
EnvVar: "PLUGIN_PRERELEASE,GITHUB_RELEASE_PRERELEASE",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "base-url",
|
||||
Value: "https://api.github.com/",
|
||||
@ -112,6 +117,7 @@ func run(c *cli.Context) error {
|
||||
FileExists: c.String("file-exists"),
|
||||
Checksum: c.StringSlice("checksum"),
|
||||
Draft: c.Bool("draft"),
|
||||
Prerelease: c.Bool("prerelease"),
|
||||
BaseURL: c.String("base-url"),
|
||||
UploadURL: c.String("upload-url"),
|
||||
},
|
||||
|
@ -30,6 +30,7 @@ type (
|
||||
FileExists string
|
||||
Checksum []string
|
||||
Draft bool
|
||||
Prerelease bool
|
||||
BaseURL string
|
||||
UploadURL string
|
||||
}
|
||||
@ -117,6 +118,7 @@ func (p Plugin) Exec() error {
|
||||
Repo: p.Repo.Name,
|
||||
Tag: filepath.Base(p.Commit.Ref),
|
||||
Draft: p.Config.Draft,
|
||||
Prerelease: p.Config.Prerelease,
|
||||
FileExists: p.Config.FileExists,
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ type releaseClient struct {
|
||||
Repo string
|
||||
Tag string
|
||||
Draft bool
|
||||
Prerelease bool
|
||||
FileExists string
|
||||
}
|
||||
|
||||
@ -51,8 +52,9 @@ func (rc *releaseClient) getRelease() (*github.RepositoryRelease, error) {
|
||||
|
||||
func (rc *releaseClient) newRelease() (*github.RepositoryRelease, error) {
|
||||
rr := &github.RepositoryRelease{
|
||||
TagName: github.String(rc.Tag),
|
||||
Draft: &rc.Draft,
|
||||
TagName: github.String(rc.Tag),
|
||||
Draft: &rc.Draft,
|
||||
Prerelease: &rc.Prerelease,
|
||||
}
|
||||
|
||||
release, _, err := rc.Client.Repositories.CreateRelease(rc.Owner, rc.Repo, rr)
|
||||
|
Loading…
Reference in New Issue
Block a user