diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..d17c7ed --- /dev/null +++ b/.drone.yml @@ -0,0 +1,78 @@ +workspace: + base: /srv/app + path: src/github.com/appleboy/drone-ssh + +pipeline: + clone: + image: plugins/git + tags: true + + # restore the cache from an sftp server + restore_cache: + image: appleboy/drone-sftp-cache + restore: true + mount: [ .glide, vendor ] + ignore_branch: true + + test: + image: appleboy/golang-testing + pull: true + environment: + TAGS: netgo + GOPATH: /srv/app + commands: + - make dep_install + - make vet + - make lint + - make test + - make coverage + - make build + # build binary for docker image + - make static_build + when: + event: [ push, tag, pull_request ] + + release: + image: appleboy/golang-testing + pull: true + environment: + TAGS: netgo + GOPATH: /srv/app + commands: + - make release + when: + event: [ tag ] + branch: [ refs/tags/* ] + + publish_tag: + image: plugins/docker + repo: ${DRONE_REPO} + tags: [ '${DRONE_TAG}' ] + when: + event: [ tag ] + branch: [ refs/tags/* ] + + publish_latest: + image: plugins/docker + repo: ${DRONE_REPO} + tags: [ 'latest' ] + when: + event: [ push ] + branch: [ master ] + + release: + image: plugins/github-release + files: + - dist/release/* + when: + event: [ tag ] + branch: [ refs/tags/* ] + + # rebuild the cache on the sftp server + rebuild_cache: + image: appleboy/drone-sftp-cache + rebuild: true + mount: [ .glide, vendor ] + ignore_branch: true + when: + branch: master diff --git a/.drone.yml.sig b/.drone.yml.sig new file mode 100644 index 0000000..552ee09 --- /dev/null +++ b/.drone.yml.sig @@ -0,0 +1,88 @@ +workspace: + base: /srv/app + path: src/github.com/appleboy/drone-scp + +pipeline: + clone: + image: plugins/git + tags: true + + # restore the cache from an sftp server + restore_cache: + image: appleboy/drone-sftp-cache + restore: true + mount: [ .glide, vendor ] + ignore_branch: true + + test: + image: appleboy/golang-testing + pull: true + environment: + TAGS: netgo + GOPATH: /srv/app + commands: + - adduser -h /home/drone-scp -s /bin/bash -D -S drone-scp + - passwd -d drone-scp + - mkdir -p /home/drone-scp/.ssh + - chmod 700 /home/drone-scp/.ssh + - cp tests/.ssh/id_rsa.pub /home/drone-scp/.ssh/authorized_keys + - chown -R drone-scp /home/drone-scp/.ssh + # install ssh and start server + - apk update && apk add openssh openrc + - rm -rf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key + - ./tests/entrypoint.sh /usr/sbin/sshd -D & + - make dep_install + - make vet + - make lint + - make test + - make coverage + - make build + # build binary for docker image + - make static_build + when: + event: [ push, tag, pull_request ] + + release: + image: appleboy/golang-testing + pull: true + environment: + TAGS: netgo + GOPATH: /srv/app + commands: + - make release + when: + event: [ tag ] + branch: [ refs/tags/* ] + + docker: + image: plugins/docker + repo: ${DRONE_REPO} + tags: [ '${DRONE_TAG}' ] + when: + event: [ tag ] + branch: [ refs/tags/* ] + + docker: + image: plugins/docker + repo: ${DRONE_REPO} + tags: [ 'latest' ] + when: + event: [ push ] + branch: [ master ] + + github: + image: plugins/github-release + files: + - dist/release/* + when: + event: [ tag ] + branch: [ refs/tags/* ] + + # rebuild the cache on the sftp server + rebuild_cache: + image: appleboy/drone-sftp-cache + rebuild: true + mount: [ .glide, vendor ] + ignore_branch: true + when: + branch: master