0
0
mirror of https://github.com/thegeeklab/wp-s3-action.git synced 2024-11-21 14:50:39 +00:00

Unification: Drone config, Makefile, structure and badges

This commit is contained in:
Thomas Boerger 2016-01-18 22:32:57 +01:00 committed by Thomas Boerger
parent 28ea5cb7de
commit 9137ce00df
5 changed files with 112 additions and 17 deletions

View File

@ -1 +1 @@
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.LD8abRfGdqm1iV1lMb_ZFRE1EJfcZ3GCcJaU5kRaHbmrvmykyDRZCRkGZxnAcKFyxKyXVj-bKCK4vGkTc0OI3-x36N20gmPPYHM17lp0vm1IZtr1zrJ0Qc0reTTE9wFp4axo6HupV2wSFbLdj3nNH_SHCybQ9bIVn_olZRoGO-3nnKBXmuy0zkTfep0K55Pbty69a1Gl4jbKxyHG50GvSgSkTpRcgSNr_itqfeOkzFkKnYXvLC5zEJ1qmv6v4MCJVvgmySUZdXcdDWoAkQvwfZ65_2NttGnRlw-zXcDHoRWmcmucrpiGT_o7XbdG06c7lcjqJ4fepaqj5eMbseoa_A.SYax_4XXsBK8Vk1D.rk1aDHYQlUwbhQaqIRlXjI247xeRAzOtG3SQrm-RYPqLklCYP2Y-DodgWndKrXQZ7R12y2v1T8TUuRbmmTHXEwTOtV_TbK4XS9jAz7mTc7rKlIahf7HSAUJVlpsGV2qUg6d0wOsd7BXlCkMCFV1A-EPlFPf8RahkKU-PgKQWZ-_2JwISvg_pGNQE3DP2yRiyZ_2LYWR3Gai-MIRWeXrAKKWtCbhTf5GmjFzA_GmONHwObhzzXm9mJgqPmi3xSJwD3c9fSG7zxaB_yVjKxo3b1nMEO-gup9Tcs0U_cAYNGJjg11larmPYIaTWy3XJqzwP84T6OTqcCsEM4ZVB1btQ8PsfiXpgYdGh3DV-DP7ngAFYc9HL5U8fp0go_HVF1C3Tf_O1aA.LWsqNX71DPdSDPFOyWy33w
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.Z39adLOkWGH8IMEhkg3-83dlz7l7ojgAGSM2zSxbqSw5KUrUHb4eSiSCzMbt27cQ9MvNEGf2aB3RXkyuPQnW7dTUVATzzNvGF7FXNgFgNUs-d8i8ewkG1m2s1CAfLZLN6i_JXFW23yVMX2YMdBiZKoNHE1pVku7NBlDp3J1dZcJOGH-hzzoPEkBCfZ8UJO4anNkHr_v5GF0SrQyF9xLUFUXeacNC6QMQfWNmIZPrsffSbXOOjBVaM_1T0h-W2iLyoWKjXbHzXDhuYvFNB7IASinQGTfukSDqg0woadWi9SiJa3N_GzzB8GNMJhTln7vTvm17gdDku_XVOMB2WpqELQ.WTa6v2ryYK14QHMU.Hc8xGmS3ACDogc5WwyzsYRHVTxmbb3iwgnc-9CcR9hF7ixdnaYi4rllTx_ZHBjIhWc7tEXfd-iEVpyOXU3h_zXrGNVIqJp5-uruV2n2sg6N5gg6TLyH82DT9f80yk2ZP2o7zZlE0ATFigObkJLwi0GM9vdz0tSJbPXq_bVAtk9U9wJazwicfg8nPYO_4uXalYbTvKFdKwBqrhyLh-UFW43heLgMgoFj8yuVJxPAJUF6CMDRnxrItNvthkKGbocrJT_Nr-wzwUwJOL0peIezfeQFYy394QhX4SlXbE6aajylrYh8CyyXdKkvIWkc8uJeVgrM6TWp1Oo56BrKdQ2jn556oLGUE_QTxDwe3eOCpTfG95Nbj71NZrr58NlV2ccJqruWKJ-3XZ0La9ywgc9eDYjbR3pbYiUY9TKB0n9BQesA.unUUW7XTnGuzELAzJUVjyg

View File

@ -1,28 +1,37 @@
build:
image: golang:1.5
environment:
- GO15VENDOREXPERIMENT=1
- GOOS=linux
- GOARCH=amd64
- CGO_ENABLED=0
commands:
- go get
- go build
- go test
- 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-s3-sync
tag: native
tag: latest
when:
branch: native
branch: master
docker:
username: $$DOCKER_USER
password: $$DOCKER_PASS
email: $$DOCKER_EMAIL
repo: plugins/drone-s3-sync
tag: develop
when:
branch: develop
plugin:
name: S3 Sync
desc: Syncs a directory with an Amazon S3 Bucket
desc: Sync a directory with an Amazon S3 Bucket
type: publish
image: plugins/drone-s3-sync
labels:

32
Makefile Normal file
View File

@ -0,0 +1,32 @@
.PHONY: clean deps fmt vet test docker
EXECUTABLE ?= drone-s3-sync
IMAGE ?= plugins/$(EXECUTABLE)
CI_BUILD_NUMBER ?= 0
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 ./...
deps:
go get -t ./...
fmt:
go fmt $(PACKAGES)
vet:
go vet $(PACKAGES)
test:
@for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
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)'
build: $(EXECUTABLE)

View File

@ -1,20 +1,41 @@
# drone-s3-sync
[![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-s3-sync/status.svg)](http://beta.drone.io/drone-plugins/drone-s3-sync)
[![Coverage Status](https://aircover.co/badges/drone-plugins/drone-s3-sync/coverage.svg)](https://aircover.co/drone-plugins/drone-s3-sync)
[![](https://badge.imagelayers.io/plugins/drone-s3-sync:latest.svg)](https://imagelayers.io/?images=plugins/drone-s3-sync:latest 'Get your own badge on imagelayers.io')
Drone plugin to synchronize files and folders with Amazon S3
Drone plugin to synchronize a directory with an Amazon S3 Bucket
## Usage
## Binary
Build the binary using `make`:
```
make deps build
```
### Example
```sh
./drone-s3-sync <<EOF
{
"repo": {
"clone_url": "git://github.com/drone/drone",
"owner": "drone",
"name": "drone",
"full_name": "drone/drone"
},
"system": {
"link_url": "https://beta.drone.io"
},
"build": {
"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",
@ -25,6 +46,14 @@ Drone plugin to synchronize files and folders with Amazon S3
"path": "/drone/src/github.com/drone/drone"
},
"vargs": {
"acl": "public-read",
"region": "us-east-1",
"bucket": "my-bucket.s3-website-us-east-1.amazonaws.com",
"access_key": "970d28f4dd477bc184fbd10b376de753",
"secret_key": "9c5785d3ece6a9cdefa42eb99b58986f9095ff1c",
"source": "folder/to/archive",
"target": "/target/location",
"delete": true
}
}
EOF
@ -32,11 +61,10 @@ EOF
## Docker
Build the Docker container using `make`:
Build the container using `make`:
```sh
make deps build
docker build --rm=true -t plugins/drone-s3-sync .
```
make deps docker
```
### Example
@ -46,9 +74,21 @@ docker run -i plugins/drone-s3-sync <<EOF
{
"repo": {
"clone_url": "git://github.com/drone/drone",
"owner": "drone",
"name": "drone",
"full_name": "drone/drone"
},
"system": {
"link_url": "https://beta.drone.io"
},
"build": {
"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",
@ -59,6 +99,14 @@ docker run -i plugins/drone-s3-sync <<EOF
"path": "/drone/src/github.com/drone/drone"
},
"vargs": {
"acl": "public-read",
"region": "us-east-1",
"bucket": "my-bucket.s3-website-us-east-1.amazonaws.com",
"access_key": "970d28f4dd477bc184fbd10b376de753",
"secret_key": "9c5785d3ece6a9cdefa42eb99b58986f9095ff1c",
"source": "folder/to/archive",
"target": "/target/location",
"delete": true
}
}
EOF

View File

@ -23,7 +23,13 @@ type result struct {
err error
}
var (
buildDate string
)
func main() {
fmt.Printf("Drone S3 Sync Plugin built at %s\n", buildDate)
vargs := PluginArgs{}
workspace := drone.Workspace{}