Skip to content

Instantly share code, notes, and snippets.

@timgreen
Last active October 4, 2022 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timgreen/8e16f5a3549f2e902ecd8fa6813beba0 to your computer and use it in GitHub Desktop.
Save timgreen/8e16f5a3549f2e902ecd8fa6813beba0 to your computer and use it in GitHub Desktop.
#!/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