-
Notifications
You must be signed in to change notification settings - Fork 11
60 lines (54 loc) · 1.96 KB
/
test_and_build.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
55
56
57
58
59
60
name: Build
on:
push:
branches:
- master
- main
jobs:
unit_test_and_build_blog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Configure Git # 配置Git
env:
DEPLOY_PRI: ${{ secrets.DEPLOY_PRI }}
GIT_USERNAME: ${{ github.repository_owner }}
GIT_EMAIL: ${{ github.repository_owner }}@user.github.com
run: |
sudo timedatectl set-timezone "Asia/Shanghai"
mkdir -p ~/.ssh/
echo "$DEPLOY_PRI" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.name $GIT_USERNAME
git config --global user.email $GIT_EMAIL
- name: Configure Hexo Unit Test # 配置 Hexo 单元测试
run: |
git clone https://github.com/hexojs/hexo-theme-unit-test.git unit_test
git clone https://github.com/Lhcfl/hexo-theme-anatolo.git unit_test/themes/Anatolo
cp ./.github/asserts/anatolo_config.yml unit_test/themes/Anatolo/_config.yml
cp ./.github/asserts/hexo_config.yml unit_test/_config.yml
cp ./.github/asserts/_posts/* unit_test/source/_posts/
cd unit_test
npm install
npm install hexo-renderer-pug --save
npm install hexo-renderer-stylus --save
npx hexo new "Anatolo简介"
cat ../README.md >> ./source/_posts/Anatolo简介.md
- name: Generate Test # 生成 Hexo 单元测试
run: |
cd unit_test
npx hexo g -b
- name: Commit And Push Blog # 提交到Git仓库
env:
GIT_URL: '[email protected]:Lhcfl/Anatolodemo.git'
run: |
cd unit_test/public
git init
git remote add origin $GIT_URL
git add -A
git commit -m "Auto generated."
git push origin HEAD:master --force