feat: version updater use case statement

Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Oleg Klyuchkin <anviar@users.noreply.github.com>
This commit is contained in:
Oleg Klyuchkin 2024-02-29 11:25:37 +03:00 committed by GitHub
parent ec522a0a3e
commit 82e81f7e57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -75,16 +75,18 @@ if [[ -z "${role}" ]]; then
fi
# Get latest version.
if [[ "${type}" == "github" ]]
then
version="$(github_api "repos/${source_repo}/releases/latest" | jq '.tag_name' | tr -d '"v')"
elif [[ "${type}" == "gitlab" ]]
then
version="$(gitlab_api "projects/${source_repo}/releases" | jq '.[0].tag_name' | tr -d '"v')"
else
echo_red 'Unknown source type. Terminating.'
exit 128
fi
case "${type}" in
github)
version="$(github_api "repos/${source_repo}/releases/latest" | jq '.tag_name' | tr -d '"v')"
;;
gitlab)
version="$(gitlab_api "projects/${source_repo}/releases" | jq '.[0].tag_name' | tr -d '"v')"
;;
*)
echo_red 'Unknown source type. Terminating.'
exit 128
;;
esac
echo_green "New ${source_repo} version is: ${version}"
# Download destination repository