-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.72 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Deploy Blog
on: [push] # 当有新push时运行
jobs:
build: # 一项叫做build的任务
runs-on: ubuntu-latest # 在最新版的Ubuntu系统下运行
steps:
- name: Checkout # 将仓库内master分支的内容下载到工作目录
uses: actions/checkout@v1 # 脚本来自 https://github.com/actions/checkout
with:
ref: hexo
- name: Use Node.js 16.x # 配置Node环境
uses: actions/setup-node@v1 # 配置脚本来自 https://github.com/actions/setup-node
with:
node-version: "16.x"
- name: Setup Hexo env
env:
ACTION_DEPLOY_KEY: ${{ secrets.ACTION_DEPLOY_KEY }}
run: |
# set up private key for deploy
mkdir -p ~/.ssh/
echo "$ACTION_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_rsa # 配置秘钥
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
# set git infomation
git config --global user.name 'aircjm' # 换成你自己的邮箱和名字
git config --global user.email '[email protected]'
# install dependencies
export TZ='Asia/Shanghai'
npm i -g hexo-cli # 安装hexo
npm i
- name: InstallPlugins
run: |
npm install hexo-renderer-pug --save
npm install hexo-renderer-stylus --save
npm install hexo-deployer-git --save
npm install hexo-generator-search --save
npm install hexo-douban --save
npm install hexo-generator-feed --save
npm install hexo-abbrlink --save
npm install hexo-wordcount --save
- name: Deploy
run: |
# publish
rm -rf .deploy_git
hexo g && hexo douban && hexo deploy # 执行部署程序
rm ~/.ssh/id_rsa