Added makefile, updated docs

This commit is contained in:
Thomas Boerger 2015-12-23 15:17:14 +01:00
parent eeab25af7c
commit a7c989263e
5 changed files with 77 additions and 23 deletions

View File

@ -1,14 +1,9 @@
build: build:
image: golang:1.5 image: golang:1.5
environment:
- GO15VENDOREXPERIMENT=1
- GOOS=linux
- GOARCH=amd64
- CGO_ENABLED=0
commands: commands:
- go get - make deps
- go build - make build
- go test - make test
publish: publish:
docker: docker:
@ -21,10 +16,9 @@ publish:
plugin: plugin:
name: GitHub Release name: GitHub Release
desc: Publish files and artifacts to GitHub releases desc: Publishs files and artifacts to GitHub Releases
type: publish type: publish
image: plugins/drone-github-release image: plugins/drone-github-release
labels: labels:
- publish
- github - github
- release - release

View File

@ -2,9 +2,9 @@ Use this plugin for publishing files and artifacts to GitHub releases. You
can override the default configuration with the following parameters: 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
* `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
Sample configuration: Sample configuration:

View File

@ -1,10 +1,14 @@
# Docker image for the Drone GitHub Release plugin # Docker image for the Drone GitHub Release plugin
# #
# cd $GOPATH/src/github.com/drone-plugins/drone-github-release # cd $GOPATH/src/github.com/drone-plugins/drone-github-release
# GO15VENDOREXPERIMENT=1 CGO_ENABLED=0 go build -a -tags netgo # make deps build docker
# docker build --rm=true -t plugins/drone-github-release .
FROM alpine:3.2 FROM alpine:3.2
RUN apk add -U ca-certificates && rm -rf /var/cache/apk/*
RUN apk update && \
apk add \
ca-certificates && \
rm -rf /var/cache/apk/*
ADD drone-github-release /bin/ ADD drone-github-release /bin/
ENTRYPOINT ["/bin/drone-github-release"] ENTRYPOINT ["/bin/drone-github-release"]

25
Makefile Normal file
View File

@ -0,0 +1,25 @@
.PHONY: clean deps test build docker
export GOOS ?= linux
export GOARCH ?= amd64
export CGO_ENABLED ?= 0
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)"
clean:
go clean -i ./...
deps:
go get -t ./...
test:
go test -cover ./...
build:
go build -ldflags '-s -w $(LDFLAGS)'
docker:
docker build --rm=true -t plugins/drone-github-release .

View File

@ -1,11 +1,12 @@
# 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)
[![](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 for publishing GitHub releases
## Usage ## Usage
Publish a release:
``` ```
./drone-github-release <<EOF ./drone-github-release <<EOF
{ {
@ -23,7 +24,7 @@ Publish a release:
}, },
"workspace": { "workspace": {
"root": "/drone/src", "root": "/drone/src",
"path": "drone/src/github.com/drone/drone" "path": "/drone/src/github.com/drone/drone"
}, },
"vargs": { "vargs": {
"api_key": "your_api_key", "api_key": "your_api_key",
@ -38,10 +39,40 @@ EOF
## Docker ## Docker
Build the Docker container using the `netgo` build tag to eliminate the CGO Build the Docker container using `make`:
dependency:
``` ```
GO15VENDOREXPERIMENT=1 CGO_ENABLED=0 go build -a -tags netgo make deps build docker
docker build --rm=true -t plugins/drone-github-release . ```
### Example
```sh
docker run -i plugins/drone-github-release <<EOF
{
"repo": {
"clone_url": "git://github.com/drone/drone",
"full_name": "drone/drone",
"owner": "drone",
"name": "drone"
},
"build": {
"event": "tag",
"branch": "refs/heads/v0.0.1",
"commit": "8f5d3b2ce38562bedb48b798328f5bb2e4077a2f",
"ref": "refs/heads/v0.0.1"
},
"workspace": {
"root": "/drone/src",
"path": "/drone/src/github.com/drone/drone"
},
"vargs": {
"api_key": "your_api_key",
"files": [
"dist/*.txt",
"dist/other-file"
]
}
}
EOF
``` ```