-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (55 loc) · 1.56 KB
/
deploy.yml
File metadata and controls
66 lines (55 loc) · 1.56 KB
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
61
62
63
64
65
66
name: 自动部署
on:
push:
branches:
- master
- content
release:
types:
- published
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
env:
TZ: Asia/Shanghai
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
steps:
- name: 检查 master 分支
uses: actions/checkout@v6
with:
ref: master
fetch-depth: 0
- name: 安装 Node
uses: actions/setup-node@v6
with:
node-version: "22.x"
- name: 启用 Corepack (激活 Yarn 4)
run: corepack enable
- name: 拉取内容分支
run: git fetch origin content:refs/remotes/origin/content
- name: 导入内容
run: ./tools/import-content-branch.sh origin/content
- name: 安装 Anzhiyu 主题
run: ./tools/prepare-anzhiyu-theme.sh
- name: 安装项目依赖
run: |
# 这一步会根据新的 package.json 安装所有东西
# 包括:hexo核心、渲染器(pug/stylus)、gulp、bangumi插件
yarn install --immutable
- name: 生成静态文件
run: |
npx hexo clean
npx hexo bangumi -u
npx hexo generate
# 如果以后需要 gulp,取消注释即可,不需要再安装 gulp-cli
# npx gulp
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: gh-pages