mirror of
https://github.com/thegeeklab/wp-gitea-release.git
synced 2024-11-24 23:10:39 +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
|
* `api_key` - GitHub oauth token with public_repo or repo permission
|
||||||
* `files` - Files to upload to GitHub Release, globs are allowed
|
* `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.
|
* `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
|
* `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
|
||||||
|
|
||||||
|
7
main.go
7
main.go
@ -103,6 +103,7 @@ func main() {
|
|||||||
Owner: repo.Owner,
|
Owner: repo.Owner,
|
||||||
Repo: repo.Name,
|
Repo: repo.Name,
|
||||||
Tag: filepath.Base(build.Ref),
|
Tag: filepath.Base(build.Ref),
|
||||||
|
Draft: vargs.Draft,
|
||||||
}
|
}
|
||||||
|
|
||||||
release, err := rc.buildRelease()
|
release, err := rc.buildRelease()
|
||||||
@ -123,6 +124,7 @@ type releaseClient struct {
|
|||||||
Owner string
|
Owner string
|
||||||
Repo string
|
Repo string
|
||||||
Tag string
|
Tag string
|
||||||
|
Draft bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rc *releaseClient) buildRelease() (*github.RepositoryRelease, error) {
|
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) {
|
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)
|
release, _, err := rc.Client.Repositories.CreateRelease(rc.Owner, rc.Repo, rr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Failed to create release: %s", err)
|
return nil, fmt.Errorf("Failed to create release: %s", err)
|
||||||
|
1
types.go
1
types.go
@ -9,4 +9,5 @@ type Params struct {
|
|||||||
APIKey string `json:"api_key"`
|
APIKey string `json:"api_key"`
|
||||||
Files drone.StringSlice `json:"files"`
|
Files drone.StringSlice `json:"files"`
|
||||||
Checksum drone.StringSlice `json:"checksum"`
|
Checksum drone.StringSlice `json:"checksum"`
|
||||||
|
Draft bool `json:"draft"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user