blog/.drone.yml

87 lines
1.7 KiB
YAML
Raw Normal View History

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
script:
- cd /www/wwwroot
- tar zcf backup.tar.gz www.eigeen.com
2022-03-31 10:25:29 +08:00
- name: upload
2022-03-30 22:16:21 +08:00
image: drillster/drone-rsync
environment:
HOST1:
from_secret: production_server_addr
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
source: ./public
target:
from_secret: deploy_dir
2022-03-31 10:25:29 +08:00
- name: deploy
image: appleboy/drone-ssh
environments:
DEPLOY_DIR:
from_secret: deploy_dir
2022-03-31 10:43:18 +08:00
GLOBIGNORE: .htaccess:.user.ini:public
2022-03-31 10:25:29 +08:00
settings:
host:
from_secret: production_server_addr
username:
from_secret: remote_user
key:
from_secret: eigeen_key
port: 22
script:
2022-03-31 10:59:32 +08:00
- echo $DEPLOY_DIR
2022-03-31 10:25:29 +08:00
2022-03-30 02:06:09 +08:00
volumes:
- name: cache
host:
path: /tmp/cache