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

Unification: Drone config, Makefile, structure and badges
release/0.4
Thomas Boerger 9 years ago
commit 8071ad8c33
  1. 2
      .drone.sec
  2. 19
      .drone.yml
  3. 29
      Makefile
  4. 71
      README.md
  5. 1
      main.go

@ -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

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

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

@ -1,26 +1,45 @@
# drone-github-release # 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) [![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') [![](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 ./drone-github-release <<EOF
{ {
"repo": { "repo": {
"clone_url": "git://github.com/drone/drone", "clone_url": "git://github.com/drone/drone",
"full_name": "drone/drone",
"owner": "drone", "owner": "drone",
"name": "drone" "name": "drone",
"full_name": "drone/drone"
},
"system": {
"link_url": "https://beta.drone.io"
}, },
"build": { "build": {
"event": "tag", "number": 22,
"branch": "refs/heads/v0.0.1", "status": "success",
"commit": "8f5d3b2ce38562bedb48b798328f5bb2e4077a2f", "started_at": 1421029603,
"ref": "refs/heads/v0.0.1" "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": { "workspace": {
"root": "/drone/src", "root": "/drone/src",
@ -33,12 +52,9 @@ Drone plugin for publishing GitHub releases
"dist/other-file" "dist/other-file"
], ],
"checksum": [ "checksum": [
"md5",
"sha1", "sha1",
"sha256", "sha256",
"sha512", "sha512"
"adler32",
"crc32"
] ]
} }
} }
@ -47,10 +63,10 @@ EOF
## Docker ## Docker
Build the Docker container using `make`: Build the container using `make`:
``` ```
make deps build docker make deps docker
``` ```
### Example ### Example
@ -60,15 +76,25 @@ docker run -i plugins/drone-github-release <<EOF
{ {
"repo": { "repo": {
"clone_url": "git://github.com/drone/drone", "clone_url": "git://github.com/drone/drone",
"full_name": "drone/drone",
"owner": "drone", "owner": "drone",
"name": "drone" "name": "drone",
"full_name": "drone/drone"
},
"system": {
"link_url": "https://beta.drone.io"
}, },
"build": { "build": {
"event": "tag", "number": 22,
"branch": "refs/heads/v0.0.1", "status": "success",
"commit": "8f5d3b2ce38562bedb48b798328f5bb2e4077a2f", "started_at": 1421029603,
"ref": "refs/heads/v0.0.1" "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": { "workspace": {
"root": "/drone/src", "root": "/drone/src",
@ -81,12 +107,9 @@ docker run -i plugins/drone-github-release <<EOF
"dist/other-file" "dist/other-file"
], ],
"checksum": [ "checksum": [
"md5",
"sha1", "sha1",
"sha256", "sha256",
"sha512", "sha512"
"adler32",
"crc32"
] ]
} }
} }

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

Loading…
Cancel
Save