Commit 8171646b authored by Benoit Lavenier's avatar Benoit Lavenier

[fix] Build: fix grep expression (take only one version)

parent d6fb1b0e
Pipeline #7124 passed with stages
in 6 minutes and 4 seconds
......@@ -9,11 +9,10 @@ then
fi
### Get version to release
current=`grep -P "version\": \"\d+.\d+.\d+(\w*)" package.json | grep -oP "\d+.\d+.\d+(\w*)"`
if [[ "_$version" != "_" ]]; then
echo "ERROR: Unable to read 'version' in the file 'package.json'."
echo " - Make sure the file 'package.json' exists and is readable."
exit 1
current=`grep -P "version\": \"\d+.\d+.\d+(\w*)" package.json | grep -m 1 -oP "\d+.\d+.\d+(\w*)"`
if [[ "_$current" == "_" ]]; then
echo "Unable to read the current version in 'package.json'. Please check version format is: x.y.z (x and y should be an integer)."
exit 1;
fi
echo "Current version: $current"
......@@ -53,10 +52,10 @@ case "$1" in
prerelease="false"
fi
description=`echo $2`
if [[ "_$description" = "_" ]]; then
description="Release v$current"
fi
description=`echo $2`
if [[ "_$description" = "_" ]]; then
description="Release v$current"
fi
result=`curl -s -H ''"$GITHUT_AUTH"'' "$REPO_API_URL/releases/tags/v$current"`
release_url=`echo "$result" | grep -P "\"url\": \"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+/releases/\d+"`
......@@ -76,7 +75,7 @@ case "$1" in
echo " - tag: v$current"
echo " - description: $description"
result=`curl -H ''"$GITHUT_AUTH"'' -s $REPO_API_URL/releases -d '{"tag_name": "v'"$current"'","target_commitish": "master","name": "'"$current"'","body": "'"$description"'","draft": false,"prerelease": '"$prerelease"'}'`
echo "DEBUG - $result"
#echo "DEBUG - $result"
upload_url=`echo "$result" | grep -P "\"upload_url\": \"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+"`
if [[ "_$upload_url" = "_" ]]; then
......
......@@ -11,7 +11,7 @@ fi
DIRNAME=`pwd`
### Get current version (package.json)
current=`grep -oP "version\": \"\d+.\d+.\d+((a|b)[0-9]+)?" package.json | grep -oP "\d+.\d+.\d+((a|b)[0-9]+)?"`
current=`grep -oP "version\": \"\d+.\d+.\d+((a|b)[0-9]+)?" package.json | grep -m 1 -oP "\d+.\d+.\d+((a|b)[0-9]+)?"`
if [[ "_$current" == "_" ]]; then
echo "Unable to read the current version in 'package.json'. Please check version format is: x.y.z (x and y should be an integer)."
exit 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment