Created
February 10, 2026 07:26
-
-
Save VioletVivirand/d8629a3331e133e4f0080d5cb864aad3 to your computer and use it in GitHub Desktop.
Download latest release's source zip archive file from GitHub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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