Skip to content

Commit 4383f0b

Browse files
committed
ci: 更新 CI 工作流配置
更新 Node.js 版本至 24,启用 yarn 缓存,升级部署 action 至 v5,添加并发控制和权限配置,并将 Algolia 索引密钥移至 secrets。
1 parent 67b022c commit 4383f0b

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
name: ci
22

33
on:
4-
# 每当 push 到 main 分支时触发部署
54
push:
65
branches: [master]
7-
# 手动触发部署
86
workflow_dispatch:
97

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: write
14+
1015
jobs:
1116
docs:
1217
runs-on: ubuntu-latest
13-
env:
14-
HEXO_ALGOLIA_INDEXING_KEY: 7e2b35b929876e054ae115f1aae550bf
1518
steps:
1619
- uses: actions/checkout@v4
1720
with:
18-
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
1921
fetch-depth: 0
2022

2123
- name: Setup Node.js
2224
uses: actions/setup-node@v4
2325
with:
24-
# 选择要使用的 node 版本
25-
node-version: "20"
26-
# 安装依赖
26+
node-version: "24"
27+
cache: "yarn"
28+
2729
- name: Install dependencies
28-
if: steps.yarn-cache.outputs.cache-hit != 'true'
2930
run: yarn --frozen-lockfile
3031

31-
- name: install algolia
32-
run: yarn add algolia
3332

3433
- name: Build frontend
3534
run: yarn build
3635

37-
- name: Get Algolia
36+
- name: Update Algolia Index
37+
env:
38+
HEXO_ALGOLIA_INDEXING_KEY: ${{ secrets.HEXO_ALGOLIA_INDEXING_KEY }}
3839
run: yarn algolia
3940

4041
- name: Deploy to GitHub Pages
41-
uses: crazy-max/ghaction-github-pages@v3
42+
uses: crazy-max/ghaction-github-pages@v5
4243
with:
4344
target_branch: gh-pages
4445
build_dir: ./public

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"version": "8.1.1"
1414
},
1515
"dependencies": {
16+
"algolia": "^0.0.0",
1617
"hexo": "^8.1.1",
1718
"hexo-algolia": "^1.3.2",
1819
"hexo-deployer-git": "^4.0.0",

0 commit comments

Comments
 (0)