Add .drone.yml pipeline

This commit is contained in:
cbrgm 2018-08-08 16:04:35 +02:00
parent ffff344c85
commit d8e10b7fd3

130
.drone.yml Normal file
View File

@ -0,0 +1,130 @@
workspace:
base: /go
path: src/github.com/drone-plugins/drone-hugo
pipeline:
deps:
image: golang:1.10
pull: true
commands:
- go get -u github.com/golang/dep/cmd/dep
- dep ensure
- dep status
test:
image: golang:1.10
pull: true
commands:
- go vet ./...
- go test -cover ./...
build_linux_amd64:
image: golang:1.10
pull: true
group: build
environment:
- GOOS=linux
- GOARCH=amd64
- CGO_ENABLED=0
commands:
- |
if test "${DRONE_TAG}" = ""; then
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-hugo github.com/drone-plugins/drone-hugo/cmd/drone-hugo
else
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-hugo github.com/drone-plugins/drone-hugo/cmd/drone-hugo
fi
# build_linux_arm64:
# image: golang:1.10
# pull: true
# group: build
# environment:
# - GOOS=linux
# - GOARCH=arm64
# - CGO_ENABLED=0
# commands:
# - |
# if test "${DRONE_TAG}" = ""; then
# go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-hugo github.com/drone-plugins/drone-hugo/cmd/drone-hugo
# else
# go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-hugo github.com/drone-plugins/drone-hugo/cmd/drone-hugo
# fi
# build_linux_arm:
# image: golang:1.10
# pull: true
# group: build
# environment:
# - GOOS=linux
# - GOARCH=arm
# - CGO_ENABLED=0
# - GOARM=7
# commands:
# - |
# if test "${DRONE_TAG}" = ""; then
# go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-hugo github.com/drone-plugins/drone-hugo/cmd/drone-hugo
# else
# go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-hugo github.com/drone-plugins/drone-hugo/cmd/drone-hugo
# fi
publish_linux_amd64:
image: plugins/docker:17.12
pull: true
secrets: [ docker_username, docker_password, hugo_version ]
group: docker
repo: plugins/hugo
auto_tag: true
auto_tag_suffix: linux-amd64
dockerfile: Dockerfile
build_args:
- HUGO_VERSION=${HUGO_VERSION}
- HUGO_ARCH=64bit
when:
event: [ push, tag ]
# publish_linux_arm64:
# image: plugins/docker:17.12
# pull: true
# secrets: [ docker_username, docker_password, hugo_version ]
# group: docker
# repo: plugins/hugo
# auto_tag: true
# auto_tag_suffix: linux-arm64
# dockerfile: Dockerfile.arm64
# build_args:
# - HUGO_VERSION=${HUGO_VERSION}
# - HUGO_ARCH=arm64
# when:
# event: [ push, tag ]
# publish_linux_arm:
# image: plugins/docker:17.12
# pull: true
# secrets: [ docker_username, docker_password, hugo_version ]
# group: docker
# repo: plugins/hugo
# auto_tag: true
# auto_tag_suffix: linux-arm
# dockerfile: Dockerfile.arm
# build_args:
# - HUGO_VERSION=${HUGO_VERSION}
# - HUGO_ARCH=arm
# when:
# event: [ push, tag ]
manifests:
image: plugins/manifest:1
pull: true
secrets: [ docker_username, docker_password ]
spec: manifest.tmpl
auto_tag: true
ignore_missing: true
when:
event: [ push, tag ]
microbadger:
image: plugins/webhook:1
pull: true
secrets: [ webhook_url ]
when:
status: [ success ]