mirror of
https://github.com/h3pdesign/Neon-Vision-Editor
synced 2026-04-21 13:27:16 +00:00
install: parse GitHub release assets via JSON for reliable one-line install
This commit is contained in:
parent
8166aab9ef
commit
807149f7c7
1 changed files with 22 additions and 4 deletions
|
|
@ -52,10 +52,28 @@ echo "Fetching latest release metadata for ${REPO}..."
|
|||
RELEASE_JSON="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest")"
|
||||
|
||||
# Prefer the actual app assets, not the source zipball.
|
||||
ASSET_URL="$(printf '%s' "${RELEASE_JSON}" | grep -Eo '"browser_download_url":[^"]+"[^"]+"' | grep -Eo 'https://[^"]+' | grep -E 'Neon\\.Vision\\.Editor\\.app\\.(zip|dmg)$' | head -n 1 || true)"
|
||||
if [ -z "${ASSET_URL}" ]; then
|
||||
ASSET_URL="$(printf '%s' "${RELEASE_JSON}" | grep -Eo '"browser_download_url":[^"]+"[^"]+"' | grep -Eo 'https://[^"]+' | grep -E '\\.(zip|dmg)$' | head -n 1 || true)"
|
||||
fi
|
||||
ASSET_URL="$(printf '%s' "${RELEASE_JSON}" | python3 -c '
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
|
||||
try:
|
||||
release = json.load(sys.stdin)
|
||||
except Exception:
|
||||
print("")
|
||||
raise SystemExit(0)
|
||||
|
||||
assets = release.get("assets") or []
|
||||
urls = [a.get("browser_download_url", "") for a in assets if isinstance(a, dict)]
|
||||
|
||||
preferred = next((u for u in urls if re.search(r"Neon\.Vision\.Editor\.app\.(zip|dmg)$", u)), "")
|
||||
if preferred:
|
||||
print(preferred)
|
||||
raise SystemExit(0)
|
||||
|
||||
fallback = next((u for u in urls if re.search(r"\.(zip|dmg)$", u)), "")
|
||||
print(fallback)
|
||||
')"
|
||||
if [ -z "${ASSET_URL}" ]; then
|
||||
echo "Could not find an app .zip or .dmg asset in the latest release." >&2
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue