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
This commit is contained in:
Morten Hekkvang
2019-02-07 07:56:53 +01:00
committed by William Cheng
parent f1a56447ba
commit aa15882e2b

View File

@@ -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} "$@"
-jar ${DIR}/${jar} "$@"