博客使用 Hexo,搭建在 Github Pages,源代码部署在 GitLab 上,使用相关 CI 自动化部署。

自动化部署

_config.yml

1
2
3
4
5
6
7
deploy:
type: git
repo: https://${username}:${token|password}@github.com/starudream/blog.git
branch: master
message: update
name: ${name}
email: ${email}

.gitlab-ci.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
image: node:lts-alpine

github:
stage: publish
script:
- apk add --no-cache git
- git config --global user.name ${name}
- git config --global user.email ${email}
- git clone https://${name}:${token|password}@github.com/starudream/blog.git .deploy_git
- npm install && npm install hexo-cli -g && hexo clean && hexo deploy
only:
- master

stages:
- publish

cache:
paths:
- node_modules