chore(workflow): 更新 GitHub Actions 工作流配置

- 升级 actions/checkout 从 v4 到 v6
- 升级 pnpm/action-setup 从 v3 到 v4 并更新版本到 latest
- 升级 actions/setup-node 从 v4 到 v6
- 升级 actions/setup-java 从 v4 到 v5
- 升级 actions/cache 从 v4 到 v5
- 升级 softprops/action-gh-release 从 v1 到 v2
- 升级 actions/configure-pages 从 v3 到 v5
- 升级 actions/deploy-pages 从 v2 到 v4
- 添加构建产物验证步骤
- 添加缓存 pnpm 依赖的配置
- 优化 Docker 镜像标签和元数据配置
- 改进条件判断逻辑以优化 Docker 推送流程
This commit is contained in:
coolxitech
2026-01-08 17:40:29 +08:00
parent 7279bcbc89
commit e4c4cdd63c
3 changed files with 81 additions and 29 deletions

View File

@@ -19,23 +19,45 @@ jobs:
- name: 检出代码
uses: actions/checkout@v6
- name: 安装 pnpm
- name: 设置 pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: 安装 Nodejs
- name: 设置 Node.js
uses: actions/setup-node@v6
with:
node-version: 20
cache: 'pnpm'
node-version: '20'
- name: 缓存 pnpm 依赖
uses: actions/cache@v5
with:
path: |
~/.pnpm-store
node_modules
key: ${{ runner.os }}-pnpm-pages-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-pages-
- name: 安装依赖
run: pnpm install
run: pnpm install --frozen-lockfile
- name: 构建前端项目
run: pnpm run build
- name: 验证构建产物
run: |
if [ ! -d "docs" ]; then
echo "❌ 构建失败docs 目录不存在"
exit 1
fi
if [ ! -f "docs/index.html" ]; then
echo "❌ 构建失败docs/index.html 不存在"
exit 1
fi
echo "✅ 构建产物验证通过"
ls -la docs/
# 关键步骤:告诉 GitHub Actions 跳过 Jekyll 检查
- name: 配置 Github Pages
uses: actions/configure-pages@v5
@@ -46,4 +68,5 @@ jobs:
path: './docs'
- name: 部署到 GitHub Pages
id: deployment
uses: actions/deploy-pages@v4