mirror of
https://github.com/thegeeklab/wp-gitea-release.git
synced 2024-11-24 13:00:40 +00:00
parent
53bcc23e1f
commit
cc6a93ab03
1
DOCS.md
1
DOCS.md
@ -4,6 +4,7 @@ can override the default configuration with the following parameters:
|
||||
* `api_key` - GitHub oauth token with public_repo or repo permission
|
||||
* `files` - Files to upload to GitHub Release, globs are allowed
|
||||
* `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
|
||||
* `base_url` - GitHub base URL, only required for GHE
|
||||
* `upload_url` - GitHub upload URL, only required for GHE
|
||||
|
||||
|
7
main.go
7
main.go
@ -103,6 +103,7 @@ func main() {
|
||||
Owner: repo.Owner,
|
||||
Repo: repo.Name,
|
||||
Tag: filepath.Base(build.Ref),
|
||||
Draft: vargs.Draft,
|
||||
}
|
||||
|
||||
release, err := rc.buildRelease()
|
||||
@ -123,6 +124,7 @@ type releaseClient struct {
|
||||
Owner string
|
||||
Repo string
|
||||
Tag string
|
||||
Draft bool
|
||||
}
|
||||
|
||||
func (rc *releaseClient) buildRelease() (*github.RepositoryRelease, error) {
|
||||
@ -155,7 +157,10 @@ func (rc *releaseClient) getRelease() (*github.RepositoryRelease, error) {
|
||||
}
|
||||
|
||||
func (rc *releaseClient) newRelease() (*github.RepositoryRelease, error) {
|
||||
rr := &github.RepositoryRelease{TagName: github.String(rc.Tag)}
|
||||
rr := &github.RepositoryRelease{
|
||||
TagName: github.String(rc.Tag),
|
||||
Draft: &rc.Draft,
|
||||
}
|
||||
release, _, err := rc.Client.Repositories.CreateRelease(rc.Owner, rc.Repo, rr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to create release: %s", err)
|
||||
|
Loading…
Reference in New Issue
Block a user