Created
February 18, 2019 17:29
-
-
Save mko-x/7e8a5a2db513b65ff9feba9898b1c9cd to your computer and use it in GitHub Desktop.
Simple shellscript (bash/sh/zsh) to download latest release of a github repository
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
#!/usr/bin/env zsh bash sh | |
# @author mko-x< | |
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | |
echo "# Download Latest Github Release\n" | |
echo "# Description: Simply download any latest Github releases of a desired repository." | |
echo "# Parameter 1: Github repository owner/user\n" | |
echo "# Parameter 2: Github repository name\n" | |
echo "# \n" | |
fi | |
# Get owner from call arg 1, set to user env var if empty | |
ARG_1_OWNER="${1:-$USER}" | |
TARGET_OWNER="${TARGET_OWNER:-$ARG_1_OWNER}" | |
ARG_2_REPO="${2:-$USER}" | |
TARGET_REPO="${TARGET_REPO:-$ARG_2_REPO}" | |
curl -s https://api.github.com/repos/$TARGET_OWNER/TARGET_REPO/releases/latest \ | |
| grep 'browser_download_url.*deb' \ | |
| cut -d : -f 2,3 \ | |
| tr -d \" \ | |
| wget -qi - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment