71 lines
1.4 KiB
YAML
71 lines
1.4 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-old-version
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
from_secret: production_server_addr
|
|
username:
|
|
from_secret: remote_user
|
|
key:
|
|
from_secret: eigeen_key
|
|
port: 22
|
|
script:
|
|
- cd /www/wwwroot
|
|
- tar zcf backup.tar.gz www.eigeen.com
|
|
- rm -rf www.eigeen.com/*
|
|
|
|
- name: deploy
|
|
image: drillster/drone-rsync
|
|
environment:
|
|
HOST1:
|
|
from_secret: production_server_addr
|
|
settings:
|
|
hosts: [ "$HOST1" ]
|
|
user:
|
|
from_secret: remote_user
|
|
key:
|
|
from_secret: eigeen_key
|
|
source: ./public
|
|
target:
|
|
from_secret: deploy_dir
|
|
|
|
volumes:
|
|
- name: cache
|
|
host:
|
|
path: /tmp/cache |