fix: 修正CD错误
CI / host (pull_request) Successful in 4s
CI / cortex-m (pull_request) Successful in 4s

This commit is contained in:
2026-07-26 23:55:44 +08:00
parent b98236466c
commit b90c98d3ad
+3 -14
View File
@@ -53,23 +53,12 @@ jobs:
VERSION="$PR_BODY" VERSION="$PR_BODY"
echo "Found version: $VERSION" echo "Found version: $VERSION"
# 检查远端是否已有此标签 # 创建本地标签(不推送远端)
if git ls-remote --tags origin "$VERSION" 2>/dev/null | grep -q .; then # Gitea Create Release API 会自动在远端创建标签
echo "Tag $VERSION already exists on remote, skipping push"
git tag "$VERSION" 2>/dev/null || true
echo "tag=$VERSION" >> "$GITHUB_OUTPUT"
exit 0
fi
# 创建并推送标签
git config user.email "ci@datarouter" git config user.email "ci@datarouter"
git config user.name "DataRouter CI" git config user.name "DataRouter CI"
git tag -a "$VERSION" -m "Release $VERSION" git tag -a "$VERSION" -m "Release $VERSION" 2>/dev/null || true
echo "Created local tag: $VERSION" echo "Created local tag: $VERSION"
# 使用 origin remote(actions/checkout 已配置好认证)
git push origin "$VERSION" 2>&1
echo "Pushed tag: $VERSION"
echo "tag=$VERSION" >> "$GITHUB_OUTPUT" echo "tag=$VERSION" >> "$GITHUB_OUTPUT"
# ── 读取标签(已有标签 / auto-tag 创建的标签)── # ── 读取标签(已有标签 / auto-tag 创建的标签)──