From b65d5c07bd8d8bb33c0ab735cccc0805708d16ff Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 19 Jan 2020 17:13:18 +0800 Subject: [PATCH 1/4] Add housekeep task to delete the previous files before deployment. --- .drone.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.drone.yml b/.drone.yml index b0e6a50..cb8abe4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -60,6 +60,17 @@ steps: - for TARGET in `find public/ -type f | egrep "\.(css|js|png|jpg|JPG|PNG|CSS|JS)$"`; do gzip -c ${TARGET} > ${TARGET}.gz; done - for TARGET in `find public/ -type f | egrep "\.(css|js|png|jpg|JPG|PNG|CSS|JS)$"`; do rm -f ${TARGET}; done + - name: housekeep + image: appleboy/drone-ssh + settings: + host: 10.0.1.166 + username: webadm + port: 10022 + key: + from_secret: ssh_key + script: + - rm -rf /var/www/test/* + - name: scp image: appleboy/drone-scp settings: From 7ff60cf0bc3ef0017ceadff0b3082a19c6f4c83f Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 19 Jan 2020 17:21:15 +0800 Subject: [PATCH 2/4] Add housekeep task to delete the previous files for Production --- .drone.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index cb8abe4..9221141 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,13 +20,27 @@ steps: - for TARGET in `find public/ -type f | egrep "\.(css|js|png|jpg|JPG|PNG|CSS|JS)$"`; do gzip -c ${TARGET} > ${TARGET}.gz; done - for TARGET in `find public/ -type f | egrep "\.(css|js|png|jpg|JPG|PNG|CSS|JS)$"`; do rm -f ${TARGET}; done + - name: housekeep + image: appleboy/drone-ssh + settings: + host: 10.0.1.166 + username: webadm + port: 10022 + key: + from_secret: ssh_key + script: + - rm -rf /var/www/blog/* + - rm -rf /home/webadm/works/public/* + - name: scp image: appleboy/drone-scp settings: host: 10.0.1.166 username: webadm port: 10022 - target: /var/www/blog + target: + - /var/www/blog + - /home/webadm/works/public source: public/ key: from_secret: ssh_key From adf94b9bd9b6be65f422c79404aaf938e972574d Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 19 Jan 2020 17:31:50 +0800 Subject: [PATCH 3/4] CI behaviour test. ``` --- a/.drone.yml +++ b/.drone.yml @@ -30,7 +30,6 @@ steps: from_secret: ssh_key script: - rm -rf /var/www/blog/* - - rm -rf /home/webadm/works/public/* - name: scp image: appleboy/drone-scp ``` --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 9221141..f7502f2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -30,7 +30,6 @@ steps: from_secret: ssh_key script: - rm -rf /var/www/blog/* - - rm -rf /home/webadm/works/public/* - name: scp image: appleboy/drone-scp From a8ee1d7512cd8a2c63b5083e08c3e7d7c4313945 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 19 Jan 2020 17:40:07 +0800 Subject: [PATCH 4/4] Add the housekeeping target. --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index f7502f2..9221141 100644 --- a/.drone.yml +++ b/.drone.yml @@ -30,6 +30,7 @@ steps: from_secret: ssh_key script: - rm -rf /var/www/blog/* + - rm -rf /home/webadm/works/public/* - name: scp image: appleboy/drone-scp