fix: 修复 CI/CD 工作流 - 移除 actions/checkout 依赖

## 问题
- actions/checkout@v4 需要 Node.js 环境
- Gitea Act Runner 默认镜像没有 Node.js
- 导致 "Cannot find: node in PATH" 错误

## 解决方案
- 使用原生 git 命令代替 actions/checkout
- 在 install job 中安装 Node.js 环境
- 所有 checkout 步骤改为 git clone

## 优点
- 不依赖 GitHub Actions 插件
- 完全使用原生命令,更稳定
- 适合国内服务器环境

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 16:40:58 +08:00
parent 6f970af5bc
commit 7bdcf07d56
+21 -4
View File
@@ -13,7 +13,15 @@ jobs:
install:
runs-on: [self-hosted, rent-deploy]
steps:
- uses: actions/checkout@v4
- name: Checkout code
run: |
git clone --depth 1 --branch ${GITHUB_REF#refs/heads/} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
git checkout ${GITHUB_SHA}
- name: Setup Node.js
run: |
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs
- name: Install dependencies
run: |
@@ -25,7 +33,10 @@ jobs:
runs-on: [self-hosted, rent-deploy]
needs: install
steps:
- uses: actions/checkout@v4
- name: Checkout code
run: |
git clone --depth 1 --branch ${GITHUB_REF#refs/heads/} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
git checkout ${GITHUB_SHA}
- name: Build shared packages
run: |
@@ -52,7 +63,10 @@ jobs:
needs: build
if: github.ref == 'refs/heads/prod'
steps:
- uses: actions/checkout@v4
- name: Checkout code
run: |
git clone --depth 1 --branch ${GITHUB_REF#refs/heads/} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
git checkout ${GITHUB_SHA}
- name: Deploy to production
run: |
@@ -74,7 +88,10 @@ jobs:
needs: build
if: github.ref == 'refs/heads/test'
steps:
- uses: actions/checkout@v4
- name: Checkout code
run: |
git clone --depth 1 --branch ${GITHUB_REF#refs/heads/} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
git checkout ${GITHUB_SHA}
- name: Deploy to test
run: |