blog/.drone.yml

92 lines
1.9 KiB
YAML

kind: pipeline
type: docker
name: deploy
steps:
- name: restore-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
restore: true
mount:
- ./node_modules
- name: generate
image: node:14-alpine
commands:
- npm install
- npm install -g hexo
- hexo g
- name: rebuild-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
rebuild: true
mount:
- ./node_modules
#当对应条件的时候才会执行
when:
status:
- success
- failure
- name: backup-site
image: appleboy/drone-ssh
settings:
host:
from_secret: production_server_addr
username:
from_secret: remote_user
key:
from_secret: eigeen_key
port: 22
envs:
- deploy_dir
script:
- echo $DEPLOY_DIR
- name: upload
image: drillster/drone-rsync
environment:
DEPLOY_DIR:
from_secret: deploy_dir
settings:
hosts: [ "$HOST1" ]
user:
from_secret: remote_user
key:
from_secret: eigeen_key
source: ./public/*
target: $DEPLOY_DIR/blog
# - name: deploy
# image: appleboy/drone-ssh
# environments:
# DEPLOY_DIR:
# from_secret: deploy_dir
# GLOBIGNORE: .htaccess:.user.ini:public
# settings:
# host:
# from_secret: production_server_addr
# username:
# from_secret: remote_user
# key:
# from_secret: eigeen_key
# port: 22
# script:
# - cd $DEPLOY_DIR
# - tar zcf backup.tar.gz ./
# - mv $DEPLOY_DIR/*
# - unset GLOBIGNORE
# - mv $DEPLOY_DIR/public/* $DEPLOY_DIR/
# - rm -r $DEPLOY_DIR/public
volumes:
- name: cache
host:
path: /tmp/cache