From 9b34661865f4c507074d767ff144f1e7a627c18b Mon Sep 17 00:00:00 2001 From: Jocelyn Le Sage Date: Fri, 13 Sep 2019 18:23:02 -0400 Subject: [PATCH] Added Drone pipeline definition file. --- .drone.yml | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..5171e9d --- /dev/null +++ b/.drone.yml @@ -0,0 +1,86 @@ +# +# Drone pipeline to build Docker image. +# + +kind: pipeline +type: docker +name: default + +steps: + +- name: build-only + image: plugins/docker + settings: + repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-} + build_args: + - DOCKER_IMAGE_VERSION=drone-ci + dry_run: true + when: + ref: + exclude: + - refs/tags/v* + +- name: set-docker-tags + image: alpine + commands: + # Always tag the Docker image with the Git tag (i.e. vX.Y.Z). + - printf "${DRONE_TAG}" >> .tags + # Tag the Docker image with with 'latest' only if not a prerelease. + - printf "${DRONE_TAG}" | grep -q '-' || printf ",latest" >> .tags + when: + ref: + - refs/tags/v* + +- name: build-and-push + image: plugins/docker + settings: + repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-} + username: + from_secret: dockerhub_username + password: + from_secret: dockerhub_password + build_args: + - DOCKER_IMAGE_VERSION=${DRONE_TAG:1} + when: + ref: + - refs/tags/v* + +- name: push-dockerhub-readme + image: jlesage/drone-push-readme + settings: + repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-} + username: + from_secret: dockerhub_username + password: + from_secret: dockerhub_password + readme: DOCKERHUB.md + when: + ref: + - refs/tags/v* + +- name: microbadger + image: plugins/webhook + settings: + urls: + from_secret: microbadger_webhook + failure: ignore + when: + ref: + - refs/tags/v* + +- name: notification + image: plugins/pushover + settings: + message: "{{ repo.owner }}/{{ repo.name }}#{{ truncate build.commit 8 }} ({{ build.branch }}) by {{ build.author }} - {{ build.message }}" + token: + from_secret: pushover_token + user: + from_secret: pushover_user + failure: ignore + when: + event: + exclude: + - pull_request + status: + - success + - failure