Last active
October 4, 2022 06:45
-
-
Save timgreen/8e16f5a3549f2e902ecd8fa6813beba0 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# Usage: | |
# REPO='cli/cli' /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/timgreen/8e16f5a3549f2e902ecd8fa6813beba0/raw)" | |
# or | |
# REPO='cli/cli' /bin/bash -c "$(curl -fsSL https://tinyurl.com/mrx345m6)" | |
# ENV | |
# - REPO | |
# e.g. 'cli/cli' | |
# - ASSET_PATTERN | |
# optional, default to all asset | |
# e.g. '.' for all, '.+.jar' for jar files only | |
# - TAG | |
# optional, default to 'latest' | |
curl -s https://api.github.com/repos/${REPO}/releases/${TAG:-latest} | \ | |
jq -r '.assets[] | select(.name|match("'${ASSET_PATTERN:-.}'")) | .browser_download_url' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment