博客代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.5 KiB

kind: pipeline
name: blog
steps:
- name: clone-themes
image: alpine/git
commands:
- git clone https://git.smallyy.cn/SmallY/NeXT.git themes/next
# 缓存node_modules
- name: restore-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
restore: true
mount:
- ./node_modules
# 恢复文件修改时间
- name: git-restore-time
image: ubuntu:18.04
commands:
- apt-get update
- apt-get install -y bash python git
- apt-get install -y git-restore-mtime
- /usr/lib/git-core/git-restore-mtime --commit-time --work-tree . --git-dir ./.git
when:
branch: master
- name: build
image: node:12.14
commands:
- mv ./next_config.yml ./themes/next/_config.yml
- npm --registry https://registry.npm.taobao.org install -g hexo
- npm --registry https://registry.npm.taobao.org install
- npm run build
- name: deploy
image: appleboy/drone-scp
settings:
username:
from_secret: username
key:
from_secret: ssh_key
host:
from_secret: host
port:
from_secret: port
source:
from_secret: source
strip_components: 1
target:
from_secret: target
rm: true
when:
branch: master
# 缓存再build
- name: rebuild-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
rebuild: true
mount:
- ./node_modules
# 缓存映射
volumes:
- name: cache
host:
path: /root/drone-cache
trigger:
branch:
include:
- master
event:
include:
- push