fix: 修复 Gitea 发布工作流在 fork/镜像仓库中的兼容性问题 #1
@@ -110,8 +110,18 @@ require_cmd() {
|
|||||||
command -v "$1" >/dev/null 2>&1 || fail "缺少命令:$1"
|
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() {
|
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() {
|
api_url() {
|
||||||
@@ -131,7 +141,7 @@ api_post_json() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
release_id_from_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"
|
[[ -n "$TAG" ]] || fail "必须指定 --tag"
|
||||||
@@ -141,7 +151,7 @@ release_id_from_json() {
|
|||||||
|
|
||||||
require_cmd curl
|
require_cmd curl
|
||||||
require_cmd git
|
require_cmd git
|
||||||
require_cmd python
|
PYTHON_BIN="$(detect_python)" || fail "缺少命令:python 或 python3"
|
||||||
|
|
||||||
for package in "${PACKAGES[@]}"; do
|
for package in "${PACKAGES[@]}"; do
|
||||||
[[ -f "$package" ]] || fail "发布包不存在:$package"
|
[[ -f "$package" ]] || fail "发布包不存在:$package"
|
||||||
|
|||||||
Reference in New Issue
Block a user