GithubのLatest Releaseからassetをダウンロードするスクリプト
はい
#!/usr/bin/env bash set -o pipefail set -eu GITHUB_USERNAME="..." GITHUB_REPONAME="..." GITHUB_API_TOKEN_USERNAME="... : "${GITHUB_API_TOKEN:=$DANGER_GITHUB_API_TOKEN}" latest_gh_release() { curl -#L -H "Authorization: token $GITHUB_API_TOKEN" "https://api.github.com/repos/$GITHUB_USERNAME/$GITHUB_REPONAME/releases/latest" } get_asset_url() { cat - | ruby -rjson -e 'puts JSON.parse(STDIN.read)["assets"].select { |j| <<the filter like `j["name"].end_with?(".apk")` %>> }.first["url"]' } download_asset() { local -r asset_url=$(latest_gh_release | get_asset_url) curl -#Lo "$1" -u "$GITHUB_API_TOKEN_USERNAME:$GITHUB_API_TOKEN" -H 'Accept: application/octet-stream' "$asset_url" } download_asset "$1"