修复Gitea内网检出超时
发布 Nacos 配置 / publish (push) Successful in 35s

This commit is contained in:
2026-08-28 15:08:01 +08:00
parent b0181edbd3
commit c50695d249
4 changed files with 33 additions and 9 deletions
+14 -4
View File
@@ -16,15 +16,25 @@ jobs:
deploy:
runs-on: jayucloud
env:
GITHUB_SERVER_URL: http://192.168.5.15:3000
WEB_TARGET_HOST: ${{ secrets.SALON_PROD_WEB_HOST }}
WEB_TARGET_PORT: ${{ secrets.SALON_PROD_WEB_PORT }}
WEB_TARGET_USER: ${{ secrets.SALON_PROD_WEB_USER }}
WEB_REMOTE_DIR: ${{ secrets.SALON_PROD_WEB_DIR }}
steps:
- name: 检出发布脚本
uses: actions/checkout@v4
with:
ref: ${{ inputs.release_sha }}
- name: 从内网 Gitea 检出发布脚本
shell: bash
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHECKOUT_SHA: ${{ inputs.release_sha }}
run: |
set -euo pipefail
test -n "$GITEA_TOKEN"
test -n "$CHECKOUT_SHA"
git init .
git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git"
git -c http.extraheader="Authorization: token $GITEA_TOKEN" fetch --no-tags --depth=1 origin "$CHECKOUT_SHA"
git checkout --detach "$CHECKOUT_SHA"
- name: 发布并校验 Salon 生产 Nacos
shell: bash
env:
+14 -5
View File
@@ -16,12 +16,21 @@ jobs:
runs-on: jayucloud
env:
GITHUB_REF_NAME: prod
GITHUB_SERVER_URL: http://192.168.5.15:3000
steps:
- name: 检出合并提交
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 0
- name: 从内网 Gitea 检出合并提交
shell: bash
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHECKOUT_SHA: ${{ github.event.pull_request.merge_commit_sha }}
run: |
set -euo pipefail
test -n "$GITEA_TOKEN"
test -n "$CHECKOUT_SHA"
git init .
git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git"
git -c http.extraheader="Authorization: token $GITEA_TOKEN" fetch --no-tags --depth=1 origin "$CHECKOUT_SHA"
git checkout --detach "$CHECKOUT_SHA"
- name: 检查构建工具链
shell: bash
run: |
@@ -4,6 +4,7 @@
- `.gitea/workflows/salon-prod-prepare.yml`:仅在 `sit` 来源的 PR 合并到 `prod` 后自动运行,构建后端、前端和 SQL 归档并上传 Artifact,不修改生产环境。
- `.gitea/workflows/salon-prod-deploy.yml`:仅支持手工运行,填写准备工作流运行 ID 和合并提交 SHA 后,下载对应 Artifact 并执行生产发布。
- 两个 Salon 工作流使用内网 Gitea API 直接拉取提交,不依赖 `actions/checkout` 的 GitHub 外部仓库;Runner 需能访问 `http://192.168.5.15:3000`。
## prod 分支保护
+4
View File
@@ -6,6 +6,10 @@
- `Test-GitState` 现在在 CI 中使用 `GITHUB_REF_NAME` 作为分支名,并在本地 detached HEAD 场景使用明确的 `DETACHED_HEAD` 标识。
- Salon 生产准备工作流显式设置 `GITHUB_REF_NAME=prod`,保持合并提交构建行为不变。
## 2026-08-28 修复 Gitea Actions 外网 checkout 超时
- 将 Salon 准备和发布工作流从外部 `actions/checkout@v4` 改为使用 Gitea 内网地址和 `GITHUB_TOKEN` 直接 fetch 指定提交,避免 Runner 访问 GitHub 时 TLS 超时。
## 2026-08-27 Gitea Runner 构建工具链修复
- 修复 `jayucloud` Runner 任务容器缺少 `pwsh` 导致 Salon 发布包构建失败的问题。