Skip to content

Instantly share code, notes, and snippets.

@VioletVivirand
Created February 10, 2026 07:26
Show Gist options
  • Select an option

  • Save VioletVivirand/d8629a3331e133e4f0080d5cb864aad3 to your computer and use it in GitHub Desktop.

Select an option

Save VioletVivirand/d8629a3331e133e4f0080d5cb864aad3 to your computer and use it in GitHub Desktop.
Download latest release's source zip archive file from GitHub
#!/bin/bash
# [NOTE] This code is generated by Kiro (kiro.dev)
# Usage: download-latest-release <owner-name>/<repo-name>
if [ -z "$1" ]; then
echo "Usage: $0 <owner/repo>"
exit 1
fi
REPO=$1
API_URL="https://api.github.com/repos/$REPO/releases/latest"
echo "Fetching latest release for $REPO..."
RESPONSE=$(curl -s "$API_URL")
TAG_NAME=$(echo "$RESPONSE" | grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4)
ZIPBALL_URL=$(echo "$RESPONSE" | grep -o '"zipball_url": "[^"]*"' | cut -d'"' -f4)
if [ -z "$ZIPBALL_URL" ]; then
echo "Error: Could not find latest release"
exit 1
fi
echo "Latest version: $TAG_NAME"
FILENAME="${REPO//\//-}-${TAG_NAME}.zip"
echo "Downloading to $FILENAME..."
curl -L -o "$FILENAME" "$ZIPBALL_URL"
echo "Download complete: $FILENAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment