@@ -14,59 +14,44 @@ jobs:
1414 permissions :
1515 contents : write
1616 concurrency :
17- group : ${{ github.workflow }}-${{ github.ref }} #
17+ group : ${{ github.workflow }}-${{ github.ref }}
1818
1919 steps :
2020 - name : Set Timezone
2121 run : export TZ='Asia/Shanghai'
2222
2323 - name : 检查分支
24- uses : actions/checkout@v2
24+ uses : actions/checkout@v4 # 升级到 v4
2525 with :
2626 fetch-depth : 0
2727
2828 - name : 安装 Node
29- uses : actions/setup-node@v1
29+ uses : actions/setup-node@v4 # 升级到 v4 (v1 已过时)
3030 with :
3131 node-version : " 22.x"
32+ cache : ' yarn' # 开启 yarn 自动缓存,替代了下面手写的 cache 步骤
3233
33- - name : 缓存 Hexo
34- id : cache-npm
35- uses : actions/cache@v3
36- env :
37- cache-name : cache-node-modules
38- with :
39- path : node_modules
40- key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
41- restore-keys : |
42- ${{ runner.os }}-build-${{ env.cache-name }}-
43- ${{ runner.os }}-build-
44- ${{ runner.os }}-
34+ # 旧的手动缓存步骤已移除,setup-node@v4 自带缓存功能
4535
4636 - name : 安装依赖
47- if : ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
4837 run : |
49- npm install gulp-cli -g
50- npm ci
51- # npm install hexo-algolia --save
38+ # 全局安装 gulp-cli (使用 yarn)
39+ yarn global add gulp-cli
40+ # 安装项目依赖 (相当于 npm ci,但读取 yarn.lock)
41+ yarn install --frozen-lockfile
5242
53- - name : 安装 Anzhiyu 主题
43+ - name : 安装 Anzhiyu 主题及相关插件
5444 run : |
45+ # 克隆主题
5546 git clone -b main https://github.com/anzhiyu-c/hexo-theme-anzhiyu.git themes/anzhiyu
56- npm install hexo-renderer-pug hexo-renderer-stylus --save
57- npm install
58- # 如果你的主题有其他依赖,也在这里安装
47+
48+ # 安装渲染器 (使用 yarn add)
49+ # 注意:建议尽量把这些依赖写进 package.json 并在本地安装好,而不要在 CI 里临时 add
50+ yarn add hexo-renderer-pug hexo-renderer-stylus
51+
52+ # 再次确保所有依赖安装完成
53+ yarn install
5954
6055 - name : 生成静态文件
6156 run : |
62- npx hexo clean
63- npx hexo bangumi -u #bilibili番剧更新
64- npx hexo generate
65- # npx hexo algolia
66- # gulp
67-
68- - name : Deploy
69- uses : peaceiris/actions-gh-pages@v4
70- with :
71- github_token : ${{ secrets.GITHUB_TOKEN }}
72- publish_dir : ./public
57+ npx hexo
0 commit comments