Merge pull request #7 from drone-plugins/feature/unification

Unification: Drone config, Makefile, structure and badges
This commit is contained in:
Thomas Boerger 2016-01-26 13:44:08 +01:00
commit 8071ad8c33
5 changed files with 84 additions and 40 deletions

View File

@ -1 +1 @@
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.R-s00gRELUNOzcRuOcoVhqltGWZKP3xQyM-WCqyszETHKr2OVBtN6dfYEEYv1jB5a_4SUs3WDJsjdXieeQsL5sWiDwSzS8cjCeLF3J0XjgmwaPL2EiJn78yHcSOfV-YhHL6fM2zdxKKKgATlKLPGyi6p-O2saL-knl3gnKnO13-ZDWoVIsYVyklFH8UscVEwI4kthGP6rFGLZon46HePvrUxdBcczBZmuqQLGxXmFBr93cX2eJ6QK8K4j6pZwtC5q8ZcrnXwwOoJW_UjZugKuzEHcS_DX_59vb5oJ1MdWhdb8Sm5MBs7nYjRpx900KZzqxG8jzQYuo5PsH4r819GeQ.1BShEZlbixdfZWJB.PuIVYaAJEsbvhqcqTQD7FLQvFDscDvQLorCq7-Gh0LoZBO-5N3XIJVtcEtetW2Dqs6srNhYwEDqryqVp7O3MHlesSuPNy8ulGjCziuqPa5qmCI2ds6gv19RAtXpzot-UobDERID0W9CfL4ZeaiW1AKQmxB52jgNnmTZ3Gqbad4ZPIKBu5BvkIPtAOmbWu7I2SKFvyp8PzD9BMfH_k-Y3_y1f0hrvFYIcl3iuL7z0LW0OAot3aLfeGSuct65Zp5qZuXdUCTCDqYInNPjIcMczZkh3GOKtSm2grRKeEE3ub1_Kmyiw_F8CWGdlYXtOXM47Y9wxmQsKuQFT1WffUW3qdJCXTMvg3ILXJ5AzeuLcX1UkD4cPYg0AfqEEaLAee_0Btfoxpg.Ai8KGIEtc3W1h_vTAZahgg
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.FkEZBgVid8dtRY6m3KbTWcbD4R67_D6Gy9DewVwbUySaQx0wuydNg6qHAyJ5barBvJqZqVT1njA_gZJ2c5jrNWvfGeXpbVWVxt88bIv1mqBV-WMcyuGXQ6JcCaDMYaof6Mb9Dguc8HqY8I2fYTgHtLpm2_AC2C-QzgD42B88TFkpre4-rUn2yYNgFLky_ctzgugcRbvjZgaJRKgNW002W3sGN-VChIiseTDyaPmeZUSzOS69nsWASLyXR1kngGUg3sqiSDlPeK3j6i1ur_F1bf71yyeiCSfEgTb6jixtwXEst2Etvb5lptN6pXqI_OAfmuLpxuRnAwzTE2RvlMBQZw.3eYpJLFsb3wr8xTa.Y_4czOKbbUZCa1_MBQISgcnQnlsLpPo3nQ5JCxa2WfG3R65vTgey_xwGWB846es1eIugf-NE9_pAhsD81tJHVhYNExxcMZbMM_q_iXFfFYMPBeT2fL9ApsJKqd6F2xf2p1pAEqCXNdhrJUd_-nOkKdOVlgk-OCvXfXuZZjxcrmkvo4B_0pe41DJIo0yxAPAGpNBlt5mCTrktC8CJZwkN6jFSrn1NGpoWCZ_Q6V7TslBkekHMf3BCDroPDTQi0a8QcGaquEl1C2baDSnLc-IrmWXM6ezpMJ_OjEL7pU45KQ9CG5-IQEVxBAhZmLHRJ5ZewJJjj0KpWYjPPOFx7bL7nDpBeANwOTwgflGALFAhYipT9oUnxkOCcuh5UVLZahHEqZ4p2WQbtlyC6IZvd-7ueyrIANm5TF6YpnY0RP076LE.kTQAsUediM3ibGMIkZa8Dg

View File

@ -1,22 +1,37 @@
build:
image: golang:1.5
environment:
- CGO_ENABLED=0
commands:
- make deps
- make vet
- make build
- make test
publish:
coverage:
when:
branch: master
docker:
username: drone
username: $$DOCKER_USER
password: $$DOCKER_PASS
email: $$DOCKER_EMAIL
repo: plugins/drone-github-release
tag: latest
when:
branch: master
docker:
username: $$DOCKER_USER
password: $$DOCKER_PASS
email: $$DOCKER_EMAIL
repo: plugins/drone-github-release
tag: develop
when:
branch: develop
plugin:
name: GitHub Release
desc: Publishs files and artifacts to GitHub Releases
desc: Publish files and artifacts to GitHub Releases
type: publish
image: plugins/drone-github-release
labels:

View File

@ -1,13 +1,11 @@
.PHONY: clean deps test build docker
export GOOS ?= linux
export GOARCH ?= amd64
export CGO_ENABLED ?= 0
.PHONY: clean deps fmt vet test docker
EXECUTABLE ?= drone-github-release
IMAGE ?= plugins/$(EXECUTABLE)
CI_BUILD_NUMBER ?= 0
LDFLAGS += -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')"
LDFLAGS += -X "main.build=$(CI_BUILD_NUMBER)"
LDFLAGS = -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')"
PACKAGES = $(shell go list ./... | grep -v /vendor/)
clean:
go clean -i ./...
@ -15,11 +13,20 @@ clean:
deps:
go get -t ./...
test:
go test -cover ./...
fmt:
go fmt $(PACKAGES)
build:
go build -ldflags '-s -w $(LDFLAGS)'
vet:
go vet $(PACKAGES)
test:
@for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
docker:
docker build --rm=true -t plugins/drone-github-release .
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-s -w $(LDFLAGS)'
docker build --rm -t $(IMAGE) .
$(EXECUTABLE): $(wildcard *.go)
go build -ldflags '-s -w $(LDFLAGS)'
build: $(EXECUTABLE)

View File

@ -1,26 +1,45 @@
# drone-github-release
[![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-github-release/status.svg)](http://beta.drone.io/drone-plugins/drone-github-release)
[![Coverage Status](https://aircover.co/badges/drone-plugins/drone-github-release/coverage.svg)](https://aircover.co/drone-plugins/drone-github-release)
[![](https://badge.imagelayers.io/plugins/drone-github-release:latest.svg)](https://imagelayers.io/?images=plugins/drone-github-release:latest 'Get your own badge on imagelayers.io')
Drone plugin for publishing GitHub releases
Drone plugin to publish files and artifacts to GitHub Release
## Usage
## Binary
Build the binary using `make`:
```
make deps build
```
### Example
```sh
./drone-github-release <<EOF
{
"repo": {
"clone_url": "git://github.com/drone/drone",
"full_name": "drone/drone",
"owner": "drone",
"name": "drone"
"name": "drone",
"full_name": "drone/drone"
},
"system": {
"link_url": "https://beta.drone.io"
},
"build": {
"event": "tag",
"branch": "refs/heads/v0.0.1",
"commit": "8f5d3b2ce38562bedb48b798328f5bb2e4077a2f",
"ref": "refs/heads/v0.0.1"
"number": 22,
"status": "success",
"started_at": 1421029603,
"finished_at": 1421029813,
"message": "Update the Readme",
"author": "johnsmith",
"author_email": "john.smith@gmail.com"
"event": "push",
"branch": "master",
"commit": "436b7a6e2abaddfd35740527353e78a227ddcb2c",
"ref": "refs/heads/master"
},
"workspace": {
"root": "/drone/src",
@ -33,12 +52,9 @@ Drone plugin for publishing GitHub releases
"dist/other-file"
],
"checksum": [
"md5",
"sha1",
"sha256",
"sha512",
"adler32",
"crc32"
"sha512"
]
}
}
@ -47,10 +63,10 @@ EOF
## Docker
Build the Docker container using `make`:
Build the container using `make`:
```
make deps build docker
make deps docker
```
### Example
@ -60,15 +76,25 @@ docker run -i plugins/drone-github-release <<EOF
{
"repo": {
"clone_url": "git://github.com/drone/drone",
"full_name": "drone/drone",
"owner": "drone",
"name": "drone"
"name": "drone",
"full_name": "drone/drone"
},
"system": {
"link_url": "https://beta.drone.io"
},
"build": {
"event": "tag",
"branch": "refs/heads/v0.0.1",
"commit": "8f5d3b2ce38562bedb48b798328f5bb2e4077a2f",
"ref": "refs/heads/v0.0.1"
"number": 22,
"status": "success",
"started_at": 1421029603,
"finished_at": 1421029813,
"message": "Update the Readme",
"author": "johnsmith",
"author_email": "john.smith@gmail.com"
"event": "push",
"branch": "master",
"commit": "436b7a6e2abaddfd35740527353e78a227ddcb2c",
"ref": "refs/heads/master"
},
"workspace": {
"root": "/drone/src",
@ -81,12 +107,9 @@ docker run -i plugins/drone-github-release <<EOF
"dist/other-file"
],
"checksum": [
"md5",
"sha1",
"sha256",
"sha512",
"adler32",
"crc32"
"sha512"
]
}
}

View File

@ -15,7 +15,6 @@ import (
)
var (
build string
buildDate string
)