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:
@@ -13,7 +13,15 @@ jobs:
|
|||||||
install:
|
install:
|
||||||
runs-on: [self-hosted, rent-deploy]
|
runs-on: [self-hosted, rent-deploy]
|
||||||
steps:
|
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
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -25,7 +33,10 @@ jobs:
|
|||||||
runs-on: [self-hosted, rent-deploy]
|
runs-on: [self-hosted, rent-deploy]
|
||||||
needs: install
|
needs: install
|
||||||
steps:
|
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
|
- name: Build shared packages
|
||||||
run: |
|
run: |
|
||||||
@@ -52,7 +63,10 @@ jobs:
|
|||||||
needs: build
|
needs: build
|
||||||
if: github.ref == 'refs/heads/prod'
|
if: github.ref == 'refs/heads/prod'
|
||||||
steps:
|
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
|
- name: Deploy to production
|
||||||
run: |
|
run: |
|
||||||
@@ -74,7 +88,10 @@ jobs:
|
|||||||
needs: build
|
needs: build
|
||||||
if: github.ref == 'refs/heads/test'
|
if: github.ref == 'refs/heads/test'
|
||||||
steps:
|
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
|
- name: Deploy to test
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user