# # 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