feat: Implement the github release helper with github.sh

This commit is contained in:
2026-06-26 19:57:47 +05:30
parent c42687a710
commit f5a266ff70
4 changed files with 63 additions and 14 deletions

View File

@@ -30,11 +30,7 @@ install_lazygit() {
fi
local latest_tag=""
if has_command curl; then
latest_tag=$(curl -sL https://api.github.com/repos/jesseduffield/lazygit/releases/latest \
| grep '"tag_name":' | head -n1 \
| sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
fi
latest_tag=$(github_get_latest_release "jesseduffield/lazygit")
if [ -z "$latest_tag" ]; then
latest_tag="v0.62.2" # fallback
@@ -49,8 +45,6 @@ install_lazygit() {
arch_str="arm64"
fi
local url="https://github.com/jesseduffield/lazygit/releases/download/${latest_tag}/lazygit_${version}_linux_${arch_str}.tar.gz"
TMP_DIR="$(make_temp_dir)"
cleanup() { rm -rf "$TMP_DIR"; }
trap cleanup EXIT
@@ -58,7 +52,7 @@ install_lazygit() {
local dest="$TMP_DIR/lazygit.tar.gz"
log_info "Downloading lazygit ${latest_tag}..."
download_file "$url" "$dest"
github_download_asset "jesseduffield/lazygit" "$latest_tag" "lazygit_${version}_linux_${arch_str}\.tar\.gz" "$dest"
log_info "Extracting..."
tar -xzf "$dest" -C "$TMP_DIR"

View File

@@ -68,15 +68,15 @@ install_yazi() {
pkg_install curl git
log_info "Fetching latest Yazi version from GitHub..."
local latest_tag
latest_tag=$(curl -sL https://api.github.com/repos/sxyazi/yazi/releases/latest | grep '"tag_name":' | head -n1 | sed -E 's/.*"tag_name": "([^"]+)".*/\1/' || true)
local latest_tag=""
latest_tag=$(github_get_latest_release "sxyazi/yazi")
if [ -z "$latest_tag" ]; then
latest_tag="v26.5.6"
fi
local deb_url="https://github.com/sxyazi/yazi/releases/download/${latest_tag}/yazi-x86_64-unknown-linux-gnu.deb"
log_info "Downloading Yazi ${latest_tag} from ${deb_url}..."
download_file "$deb_url" "$TMP_DIR/yazi.deb"
log_info "Downloading Yazi ${latest_tag}..."
github_download_asset "sxyazi/yazi" "$latest_tag" "yazi-x86_64-unknown-linux-gnu\.deb" "$TMP_DIR/yazi.deb"
log_info "Installing Yazi package..."
sudo apt install -y "$TMP_DIR/yazi.deb"