updating checksums to checksum and using drone.StringSlice instead of []string

This commit is contained in:
jackspirou 2016-01-15 15:30:59 -06:00
parent 0510b54fc4
commit fcfb446e4c
4 changed files with 24 additions and 11 deletions

15
DOCS.md
View File

@ -3,7 +3,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
* `checksums` - Checksum hashes to include in your GitHub release for all 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.
* `base_url` - GitHub base URL, only required for GHE
* `upload_url` - GitHub upload URL, only required for GHE
@ -15,7 +15,18 @@ publish:
api_key: my_github_api_key
files:
- dist/*
checksums:
checksum: sha1
```
or
```yaml
publish:
github_release:
api_key: my_github_api_key
files:
- dist/*
checksum:
- md5
- sha1
- sha256

View File

@ -32,7 +32,7 @@ Drone plugin for publishing GitHub releases
"dist/*.txt",
"dist/other-file"
],
"checksums": [
"checksum": [
"md5",
"sha1",
"sha256",
@ -80,7 +80,7 @@ docker run -i plugins/drone-github-release <<EOF
"dist/*.txt",
"dist/other-file"
],
"checksums": [
"checksum": [
"md5",
"sha1",
"sha256",

View File

@ -71,9 +71,9 @@ func main() {
}
}
if len(vargs.Checksums) > 0 {
if vargs.Checksum.Len() > 0 {
var err error
files, err = writeChecksums(files, vargs.Checksums)
files, err = writeChecksums(files, vargs.Checksum.Slice())
if err != nil {
fmt.Println(err)
os.Exit(1)

View File

@ -1,10 +1,12 @@
package main
import "github.com/drone/drone-go/drone"
// Params are the parameters that the GitHub Release plugin can parse.
type Params struct {
BaseURL string `json:"base_url"`
UploadURL string `json:"upload_url"`
APIKey string `json:"api_key"`
Files []string `json:"files"`
Checksums []string `json:"checksums"`
Checksum drone.StringSlice `json:"checksum"`
}