2023-08-08 16:50:33 +08:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: blog-publish
|
|
|
|
|
2023-08-08 16:53:10 +08:00
|
|
|
clone:
|
2023-08-12 10:12:53 +08:00
|
|
|
disable: true # 启用代码拉取
|
|
|
|
|
2023-08-08 16:53:10 +08:00
|
|
|
|
2023-08-08 16:50:33 +08:00
|
|
|
steps:
|
2023-08-12 10:14:00 +08:00
|
|
|
- name: check_cache
|
2023-08-12 10:12:53 +08:00
|
|
|
image: alpine/git
|
|
|
|
commands:
|
|
|
|
- if [ -d ".git" ]; then
|
2023-08-12 10:32:40 +08:00
|
|
|
echo "Cache exists,pulling newer commit"
|
2023-08-12 10:12:53 +08:00
|
|
|
git pull
|
2023-08-12 10:32:40 +08:00
|
|
|
else
|
|
|
|
echo "Cache not exists,cloning"
|
2023-08-12 10:36:50 +08:00
|
|
|
git clone https://gitea.inksoul.top/inksoul/InkSoul.git;
|
2023-08-12 10:12:53 +08:00
|
|
|
fi
|
|
|
|
|
2023-08-08 16:50:33 +08:00
|
|
|
- name: build
|
2023-08-08 16:53:10 +08:00
|
|
|
image: inksoul/hugo-rsync
|
|
|
|
volumes: #挂载数据卷
|
2023-08-08 16:54:33 +08:00
|
|
|
- name: blog
|
|
|
|
path: /data
|
|
|
|
commands:
|
|
|
|
- hugo
|
|
|
|
- rsync -a --delete --exclude '.user.ini' public/ /data
|
2023-08-08 16:50:33 +08:00
|
|
|
|
2023-08-12 10:12:53 +08:00
|
|
|
- name: save_cache
|
|
|
|
image: drillster/drone-volume-cache
|
|
|
|
settings:
|
|
|
|
cache_to:
|
|
|
|
- .git
|
2023-08-12 10:19:41 +08:00
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
path: .git
|
2023-08-12 10:12:53 +08:00
|
|
|
|
2023-08-08 16:50:33 +08:00
|
|
|
volumes: #声明数据卷
|
|
|
|
- name: blog
|
|
|
|
host:
|
2023-08-12 10:38:19 +08:00
|
|
|
path: /home/ubuntu/myWork/Blog/InkSoul/public
|
2023-08-12 10:12:53 +08:00
|
|
|
- name: cache
|
2023-08-12 10:19:41 +08:00
|
|
|
host:
|
2023-08-12 10:38:19 +08:00
|
|
|
path: /home/ubuntu/myWork/blogCachePath
|