blog/.drone.yml

128 lines
3.6 KiB
YAML

kind: pipeline
type: docker
name: production
steps:
- name: Modify-Amazon-Links
image: alpine:3.9
commands:
- grep -l -r ecx.images-amazon.com content/ | sort | uniq | xargs -t --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g"
- grep -l -r "http://www.amazon.co.jp/exec" content/ | sort | uniq | xargs -t --no-run-if-empty sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g"
- name: generate-ogp-images
image: reg.kazu634.com/kazu634/tcardgen
environment:
OGP_DIR: static/ogp/
CONTENT_DIR: content/
FONT_DIR: assets/font/
CONFIG: assets/tcardgen.yaml
commands:
- find ${OGP_DIR} -type f -name '*.png' | xargs -t --no-run-if-empty rm
- LIST=`find ${CONTENT_DIR} -type f -name '*.md' | grep -v '_index'`
- for ARTICLE in ${LIST} ; do
- /tcardgen -f ${FONT_DIR} -o ${OGP_DIR} -c ${CONFIG} ${ARTICLE}
- done
- name: hugo
image: cibuilds/hugo:0.83.0
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/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
- /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: Modify-Amazon-Links
image: alpine:3.9
commands:
- grep -l -r ecx.images-amazon.com content/ | sort | uniq | xargs -t --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g"
- grep -l -r "http://www.amazon.co.jp/exec" content/ | sort | uniq | xargs -t --no-run-if-empty sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g"
- name: generate-ogp-images
image: reg.kazu634.com/kazu634/tcardgen:v0.1
environment:
OGP_DIR: static/ogp/
CONTENT_DIR: content/
FONT_DIR: assets/font/
CONFIG: assets/tcardgen.yaml
commands:
- find static/ogp/ -type f -name '*.png' | xargs -t --no-run-if-empty rm
- find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 -t tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml
- name: hugo
image: cibuilds/hugo:0.83.0
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/*
- name: scp
image: appleboy/drone-scp
settings:
host: 10.0.1.166
username: webadm
port: 10022
target: /var/www/test
source: public/
key:
from_secret: ssh_key
overwrite: true
strip_components: 1
trigger:
branch:
exclude:
- master