diff --git a/skm.sh b/skm.sh index 8be96e2..dde3fce 100644 --- a/skm.sh +++ b/skm.sh @@ -32,11 +32,17 @@ detect_platform() { esac } +# ── Fixed function ────────────────────────────────────── get_latest_tag() { need curl - curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \ - | grep -m1 '"tag_name":' \ - | sed -E 's/.*"tag_name": *"([^"]+)".*/\1/' + local json tag + json="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest")" + tag="$(printf '%s\n' "$json" | sed -nE 's/.*"tag_name": *"([^"]+)".*/\1/p' | head -n1)" + if [ -z "$tag" ]; then + echo "❌ Failed to determine latest release tag from GitHub API" >&2 + exit 1 + fi + printf '%s\n' "$tag" } build_url() { @@ -101,4 +107,4 @@ if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" fi -echo "✅ Done. Version: $($PREFIX/skm --version)" \ No newline at end of file +echo "✅ Done. Version: $($PREFIX/skm --version)"