fix: 修复 Gitea 发布工作流在 fork/镜像仓库中的兼容性问题 #1

Merged
Eeveid merged 24 commits from zhilv/lightOps:main into main 2026-05-28 18:53:16 +08:00
Showing only changes of commit 57447882cb - Show all commits

View File

@@ -110,8 +110,18 @@ require_cmd() {
command -v "$1" >/dev/null 2>&1 || fail "缺少命令:$1"
}
detect_python() {
if command -v python3 >/dev/null 2>&1; then
echo "python3"
elif command -v python >/dev/null 2>&1; then
echo "python"
else
return 1
fi
}
json_escape() {
python -c 'import json,sys; print(json.dumps(sys.stdin.read()))'
"$PYTHON_BIN" -c 'import json,sys; print(json.dumps(sys.stdin.read()))'
}
api_url() {
@@ -131,7 +141,7 @@ api_post_json() {
}
release_id_from_json() {
python -c 'import json,sys; print(json.load(sys.stdin)["id"])'
"$PYTHON_BIN" -c 'import json,sys; print(json.load(sys.stdin)["id"])'
}
[[ -n "$TAG" ]] || fail "必须指定 --tag"
@@ -141,7 +151,7 @@ release_id_from_json() {
require_cmd curl
require_cmd git
require_cmd python
PYTHON_BIN="$(detect_python)" || fail "缺少命令python 或 python3"
for package in "${PACKAGES[@]}"; do
[[ -f "$package" ]] || fail "发布包不存在:$package"