From aa15882e2bfb953b7f1f2f3a052e76b3c31066ff Mon Sep 17 00:00:00 2001 From: Morten Hekkvang Date: Thu, 7 Feb 2019 07:56:53 +0100 Subject: [PATCH] Update openapi-generator-cli.sh (#2065) * `jq` executable is a much cleaner way to get version number * Using `jq` and getting `releases` instead of `tags` allows us to get latest stable release --- bin/utils/openapi-generator-cli.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/utils/openapi-generator-cli.sh b/bin/utils/openapi-generator-cli.sh index a21e08a0d1f6..f4b1adabadc7 100644 --- a/bin/utils/openapi-generator-cli.sh +++ b/bin/utils/openapi-generator-cli.sh @@ -20,7 +20,7 @@ #### set -o pipefail -for cmd in {mvn,python,curl}; do +for cmd in {mvn,jq,curl}; do if ! command -v ${cmd} > /dev/null; then >&2 echo "This script requires '${cmd}' to be installed." exit 1 @@ -28,8 +28,8 @@ for cmd in {mvn,python,curl}; do done function latest.tag { - local uri="https://api.github.com/repos/${1}/tags" - curl -s ${uri} | python -c "import sys, json; print json.load(sys.stdin)[0]['name'][1:]" + local uri="https://api.github.com/repos/${1}/releases" + curl -s ${uri} | jq -r 'first(.[]|select(.prerelease==false)).tag_name } ghrepo=openapitools/openapi-generator @@ -57,4 +57,4 @@ java -ea \ -Xms512M \ -Xmx1024M \ -server \ - -jar ${DIR}/${jar} "$@" \ No newline at end of file + -jar ${DIR}/${jar} "$@"