ci: use python3-or-python fallback in release upload steps
Release / linux (push) Failing after 3m37s
Release / windows (push) Failing after 17m48s

Windows installs Python as 'python' (python3 is a Store alias), so the upload
step's python3 JSON parsing failed on the Windows runner. Fall back to 'python'
when python3 is absent.
This commit is contained in:
2026-09-01 11:18:06 +08:00
parent 042d05245e
commit 064e935a60
+6 -4
View File
@@ -137,16 +137,17 @@ jobs:
set -euo pipefail set -euo pipefail
API="${GITEA_SERVER}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}" API="${GITEA_SERVER}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}"
AUTH="Authorization: token ${GITHUB_TOKEN}" AUTH="Authorization: token ${GITHUB_TOKEN}"
PY="python3"; command -v python3 >/dev/null 2>&1 || PY="python"
# Ensure the release exists (idempotent — both jobs may call this). # Ensure the release exists (idempotent — both jobs may call this).
REL_ID=$(curl -fsS -H "$AUTH" "${API}/releases/tags/${TAG}" \ REL_ID=$(curl -fsS -H "$AUTH" "${API}/releases/tags/${TAG}" \
| python3 -c "import sys,json;print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true) | $PY -c "import sys,json;print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
if [ -z "$REL_ID" ]; then if [ -z "$REL_ID" ]; then
BODY="Gridline ${TAG#v} — Linux and Windows installers." BODY="Gridline ${TAG#v} — Linux and Windows installers."
REL_ID=$(curl -fsS -X POST -H "$AUTH" -H "Content-Type: application/json" \ REL_ID=$(curl -fsS -X POST -H "$AUTH" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG}\",\"name\":\"Gridline ${TAG#v}\",\"body\":\"${BODY}\",\"draft\":true}" \ -d "{\"tag_name\":\"${TAG}\",\"name\":\"Gridline ${TAG#v}\",\"body\":\"${BODY}\",\"draft\":true}" \
"${API}/releases" \ "${API}/releases" \
| python3 -c "import sys,json;print(json.load(sys.stdin)['id'])") | $PY -c "import sys,json;print(json.load(sys.stdin)['id'])")
fi fi
BUNDLE="${GITHUB_WORKSPACE}/desktop/src-tauri/target/release/bundle" BUNDLE="${GITHUB_WORKSPACE}/desktop/src-tauri/target/release/bundle"
@@ -249,15 +250,16 @@ jobs:
set -euo pipefail set -euo pipefail
API="${GITEA_SERVER}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}" API="${GITEA_SERVER}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}"
AUTH="Authorization: token ${GITHUB_TOKEN}" AUTH="Authorization: token ${GITHUB_TOKEN}"
PY="python3"; command -v python3 >/dev/null 2>&1 || PY="python"
REL_ID=$(curl -fsS -H "$AUTH" "${API}/releases/tags/${TAG}" \ REL_ID=$(curl -fsS -H "$AUTH" "${API}/releases/tags/${TAG}" \
| python3 -c "import sys,json;print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true) | $PY -c "import sys,json;print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
if [ -z "$REL_ID" ]; then if [ -z "$REL_ID" ]; then
BODY="Gridline ${TAG#v} — Linux and Windows installers." BODY="Gridline ${TAG#v} — Linux and Windows installers."
REL_ID=$(curl -fsS -X POST -H "$AUTH" -H "Content-Type: application/json" \ REL_ID=$(curl -fsS -X POST -H "$AUTH" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG}\",\"name\":\"Gridline ${TAG#v}\",\"body\":\"${BODY}\",\"draft\":true}" \ -d "{\"tag_name\":\"${TAG}\",\"name\":\"Gridline ${TAG#v}\",\"body\":\"${BODY}\",\"draft\":true}" \
"${API}/releases" \ "${API}/releases" \
| python3 -c "import sys,json;print(json.load(sys.stdin)['id'])") | $PY -c "import sys,json;print(json.load(sys.stdin)['id'])")
fi fi
BUNDLE="${GITHUB_WORKSPACE}/desktop/src-tauri/target/release/bundle" BUNDLE="${GITHUB_WORKSPACE}/desktop/src-tauri/target/release/bundle"