From fcfb446e4c88659a14855b7362bfc1a59984d5db Mon Sep 17 00:00:00 2001 From: jackspirou Date: Fri, 15 Jan 2016 15:30:59 -0600 Subject: [PATCH] updating checksums to checksum and using drone.StringSlice instead of []string --- DOCS.md | 15 +++++++++++++-- README.md | 4 ++-- main.go | 4 ++-- types.go | 12 +++++++----- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/DOCS.md b/DOCS.md index 84537c5..e5badea 100644 --- a/DOCS.md +++ b/DOCS.md @@ -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 diff --git a/README.md b/README.md index 7c7a579..56710a4 100644 --- a/README.md +++ b/README.md @@ -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 < 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) diff --git a/types.go b/types.go index 2468f67..0dc5e86 100644 --- a/types.go +++ b/types.go @@ -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"` + BaseURL string `json:"base_url"` + UploadURL string `json:"upload_url"` + APIKey string `json:"api_key"` + Files []string `json:"files"` + Checksum drone.StringSlice `json:"checksum"` }