21 lines
455 B
Bash
Executable File
21 lines
455 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
API='https://gitlab.com/api/v4'
|
|
|
|
function get_urls() {
|
|
local repo="$1"
|
|
|
|
curl -L "$API/projects/$repo/releases" | \
|
|
jq -r '.[0].assets.links | select(.[].name | test(".apk$")) | .[].url'
|
|
}
|
|
|
|
function get_repo_name_from_url() {
|
|
printf '%s' \
|
|
"$(grep -Po '(?<=gitlab.com/)[[:alnum:]]+/[[:alnum:]]+' <<< "$1")" | \
|
|
jq -sRr '@uri'
|
|
}
|
|
|
|
for repo in "$@"; do
|
|
get_urls "$(get_repo_name_from_url "$repo")"
|
|
done
|