Github Actions配置

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
name: HEXO自动部署

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v1

- name: 使用 Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: 配置环境
env:
HEXO_DEPLOY_PRI: ${{secrets.HEXO_DEPLOY_PRI}}
run: |
mkdir -p ~/.ssh/
echo "$HEXO_DEPLOY_PRI" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.name "${{secrets.GITNAME}}"
git config --global user.email "${{secrets.GITME}}"
- name: 安装依赖项
run: |
npm i -g hexo-cli
npm install hexo-renderer-pug hexo-renderer-stylus --save
npm install hexo-wordcount --save
npm install hexo-butterfly-clock-anzhiyu --save
npm i hexo-history-calendar --save
npm install hexo-bilibili-bangumi --save
npm install hexo-douban --save
npm install --save hexo-tag-aplayer
npm install hexo-algoliasearch --save
npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-kramed --save
npm i

- name: 部署 hexo
run: |
hexo clean && hexo bangumi -u && hexo generate && hexo deploy && hexo algolia --no-clear