2022-03-30 02:06:09 +08:00
|
|
|
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
|
2022-03-30 02:09:26 +08:00
|
|
|
- npm install -g hexo
|
2022-03-30 02:06:09 +08:00
|
|
|
- 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
|
|
|
|
|
2022-03-31 10:25:29 +08:00
|
|
|
- name: backup-site
|
2022-03-30 22:16:21 +08:00
|
|
|
image: appleboy/drone-ssh
|
|
|
|
settings:
|
|
|
|
host:
|
|
|
|
from_secret: production_server_addr
|
|
|
|
username:
|
|
|
|
from_secret: remote_user
|
|
|
|
key:
|
|
|
|
from_secret: eigeen_key
|
|
|
|
port: 22
|
2022-03-31 12:54:17 +08:00
|
|
|
envs:
|
|
|
|
- deploy_dir
|
2022-03-30 22:16:21 +08:00
|
|
|
script:
|
2022-03-31 12:54:17 +08:00
|
|
|
- echo $DEPLOY_DIR
|
2022-03-30 22:16:21 +08:00
|
|
|
|
2022-03-31 10:25:29 +08:00
|
|
|
- name: upload
|
2022-03-30 22:16:21 +08:00
|
|
|
image: drillster/drone-rsync
|
|
|
|
environment:
|
2022-03-31 12:54:17 +08:00
|
|
|
DEPLOY_DIR:
|
|
|
|
from_secret: deploy_dir
|
2022-03-30 22:16:21 +08:00
|
|
|
settings:
|
2022-03-30 22:22:13 +08:00
|
|
|
hosts: [ "$HOST1" ]
|
2022-03-30 22:16:21 +08:00
|
|
|
user:
|
|
|
|
from_secret: remote_user
|
|
|
|
key:
|
|
|
|
from_secret: eigeen_key
|
2022-03-31 12:54:17 +08:00
|
|
|
source: ./public/*
|
|
|
|
target: $DEPLOY_DIR/blog
|
2022-03-30 22:16:21 +08:00
|
|
|
|
2022-03-31 12:54:17 +08:00
|
|
|
# - 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
|
2022-03-31 10:25:29 +08:00
|
|
|
|
2022-03-30 02:06:09 +08:00
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
host:
|
|
|
|
path: /tmp/cache
|