From 79258829b20a6d1ac4351579cdc8db3ef1b35288 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Tue, 3 Jan 2023 12:55:28 +0900 Subject: [PATCH] =?UTF-8?q?`Drone`=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..197789a --- /dev/null +++ b/.drone.yml @@ -0,0 +1,100 @@ +kind: pipeline +type: docker +name: production + +steps: + - name: submodules + image: alpine/git + commands: + - git submodule update --init --recursive + + - name: hugo + image: cibuilds/hugo:0.106 + commands: + - sudo hugo -e production --minify -v -s . + + - name: Compress-the-Assets + image: alpine:3.9 + commands: + - find public/ -type f | egrep "\.(css|js|png|jpg|html|JPG|PNG|CSS|JS|HTML)$" | xargs -n 1 -i% -P 0 sh -c 'cp % %.bk && gzip % && mv %.bk %' + + - 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/everun/* + - 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/everun + - /home/webadm/works/public + source: public/ + key: + from_secret: ssh_key + overwrite: true + strip_components: 1 + +trigger: + branch: + - master + +--- +kind: pipeline +type: docker +name: staging + +steps: + - name: submodules + image: alpine/git + commands: + - git submodule update --init --recursive + + - name: hugo + image: cibuilds/hugo:0.106 + commands: + - sudo hugo -e staging --minify -v -s . + + - name: Compress-the-Assets + image: alpine:3.9 + commands: + - find public/ -type f | egrep "\.(css|js|png|jpg|html|JPG|PNG|CSS|JS|HTML)$" | xargs -n 1 -i% -P 0 sh -c 'cp % %.bk && gzip % && mv %.bk %' + + - 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-everun/* + + - name: scp + image: appleboy/drone-scp + settings: + host: 10.0.1.166 + username: webadm + port: 10022 + target: /var/www/test-everun + source: public/ + key: + from_secret: ssh_key + overwrite: true + strip_components: 1 + +trigger: + branch: + exclude: + - master