🐛 fix(workflow): 避免发布流程检出阶段卡住
- 检出代码时按标签直接浅克隆,避免 clone 后再次 fetch tags - 为 git 检出步骤设置 GIT_TERMINAL_PROMPT=0,防止凭证等待导致任务挂起 - 用本地提交校验替代多余的远程访问,降低 runner 在镜像仓库发布时的阻塞风险
This commit is contained in:
@@ -12,6 +12,7 @@ jobs:
|
||||
- name: 检出代码
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GIT_TERMINAL_PROMPT: "0"
|
||||
run: |
|
||||
set -eux
|
||||
SERVER_URL="${GITHUB_SERVER_URL:-${GITEA_SERVER_URL:-https://gitea.kmux.cn}}"
|
||||
@@ -35,13 +36,12 @@ jobs:
|
||||
rm -rf lightops-src
|
||||
if [ -n "${GITEA_TOKEN:-}" ]; then
|
||||
AUTH_HEADER="Authorization: Basic $(printf 'oauth2:%s' "$GITEA_TOKEN" | base64 | tr -d '\n')"
|
||||
git -c http.extraHeader="$AUTH_HEADER" clone "$CLONE_URL" lightops-src
|
||||
git -c http.extraHeader="$AUTH_HEADER" clone --branch "$TAG" --depth 1 --single-branch "$CLONE_URL" lightops-src
|
||||
else
|
||||
git clone "$CLONE_URL" lightops-src
|
||||
git clone --branch "$TAG" --depth 1 --single-branch "$CLONE_URL" lightops-src
|
||||
fi
|
||||
cd lightops-src
|
||||
git fetch --tags --force
|
||||
git checkout "$TAG"
|
||||
git rev-parse --verify HEAD
|
||||
|
||||
- name: 安装系统依赖
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user