From 4896480b0091e2619bfa455801856e4438aa39d4 Mon Sep 17 00:00:00 2001 From: surtur Date: Sat, 3 Oct 2020 20:50:00 +0200 Subject: [PATCH] add: docker-compose-build pipeline * general refactoring of .drone.yml --- .drone.yml | 87 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 19 deletions(-) diff --git a/.drone.yml b/.drone.yml index 5287e70..60cfc76 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,10 +36,8 @@ platform: arch: amd64 trigger: - branch: - - master - event: - - pull_request + branch: [master, testing] + event: pull_request depends_on: - pull @@ -57,23 +55,21 @@ steps: --- kind: pipeline type: docker -name: docker-build +name: docker-compose-build platform: os: linux arch: amd64 trigger: - branch: - - master - event: - - pull_request + branch: master + event: pull_request depends_on: - build steps: -- name: docker-build +- name: build pull: always image: tmaier/docker-compose:latest volumes: @@ -91,7 +87,7 @@ volumes: --- kind: pipeline type: docker -name: deploy +name: deploy-staging platform: os: linux @@ -99,15 +95,12 @@ platform: trigger: branch: - - master - testing event: - exclude: - - pull_request - - tag + exclude: [pull_request, tag] depends_on: -- docker-build +- build steps: - name: hugo-extended @@ -126,7 +119,7 @@ steps: status: - success branch: - - master + - testing depends_on: - hugo-extended environment: @@ -142,6 +135,63 @@ steps: - rsync -av --delete --chown $OL public/ $OL@dotya.ml:$OL_D +--- +kind: pipeline +type: docker +name: deploy + +platform: + os: linux + arch: amd64 + +trigger: + branch: + - master + event: + exclude: [pull_request, tag] + +depends_on: +- build + +steps: +- name: hugo-extended + pull: if-not-exists + image: immawanderer/fedora-hugo:latest + commands: + - git submodule init + - git submodule update + - hugo version + - hugo --gc=true --minify + +- name: rm-intermediate + pull: if-not-exists + image: immawanderer/fedora-hugo:latest + depends_on: + - hugo-extended + commands: + - rm -rf ./public + +- name: build + pull: always + image: tmaier/docker-compose:latest + depends_on: + - rm-intermediate + volumes: + - name: s + path: /var/run/docker.sock + commands: + - docker stop homepage || true + - docker-compose up --build -d + when: + branch: master + status: success + +volumes: +- name: s + host: + path: /var/run/docker.sock + + --- kind: pipeline name: notifications @@ -164,8 +214,7 @@ trigger: - success - failure -depends_on: -- deploy +depends_on: [deploy, deploy-staging] steps: - name: discord