Skip to content
Snippets Groups Projects
Commit 05ff190b authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Release script: Detect open JDK version

parent d45becae
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ branch=`git rev-parse --abbrev-ref HEAD` ...@@ -5,7 +5,7 @@ branch=`git rev-parse --abbrev-ref HEAD`
if [[ ! "$branch" = "master" ]]; if [[ ! "$branch" = "master" ]];
then then
echo ">> This script must be run under \`master\` branch" echo ">> This script must be run under \`master\` branch"
exit -1 exit 1
fi fi
DIRNAME=`pwd` DIRNAME=`pwd`
...@@ -14,7 +14,7 @@ DIRNAME=`pwd` ...@@ -14,7 +14,7 @@ DIRNAME=`pwd`
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 -oP "\d+.\d+.\d+((a|b)[0-9]+)?"`
if [[ "_$current" == "_" ]]; then 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)." 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; exit 1;
fi fi
echo "Current version: $current" echo "Current version: $current"
...@@ -22,7 +22,7 @@ echo "Current version: $current" ...@@ -22,7 +22,7 @@ echo "Current version: $current"
currentAndroid=`grep -oP "android-versionCode=\"[0-9]+\"" config.xml | grep -oP "\d+"` currentAndroid=`grep -oP "android-versionCode=\"[0-9]+\"" config.xml | grep -oP "\d+"`
if [[ "_$currentAndroid" == "_" ]]; then if [[ "_$currentAndroid" == "_" ]]; then
echo "Unable to read the current Android version in 'config.xml'. Please check version format is an integer." echo "Unable to read the current Android version in 'config.xml'. Please check version format is an integer."
exit -1; exit 1;
fi fi
echo "Current Android version: $currentAndroid" echo "Current Android version: $currentAndroid"
...@@ -49,25 +49,27 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -49,25 +49,27 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
;; ;;
*) *)
echo "No task given" echo "No task given"
exit -1 exit 1
;; ;;
esac esac
# Load env.sh if exists # Load env.sh if exists
if [[ -f "${DIRNAME}/env.sh" ]]; then if [[ -f "${DIRNAME}/.local/env.sh" ]]; then
source ${DIRNAME}/env.sh $* echo "Loading .local/env.sh ..."
source "${DIRNAME}/.local/env.sh" $*
fi fi
# Check the Java version # Check the Java version
JAVA_VERSION=`java -version 2>&1 | grep "java version" | awk '{print $3}' | tr -d \"` JAVA_VERSION=`java -version 2>&1 | egrep "(java|openjdk) version" | awk '{print $3}' | tr -d \"`
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "No Java JRE 1.8 found in machine. This is required for Android artifacts." echo "No Java JRE 1.8 found in machine. This is required for Android artifacts."
exit -1 exit 1
fi fi
JAVA_MAJOR_VERSION=`echo ${JAVA_VERSION} | awk '{split($0, array, ".")} END{print array[1]}'`
JAVA_MINOR_VERSION=`echo ${JAVA_VERSION} | awk '{split($0, array, ".")} END{print array[2]}'` JAVA_MINOR_VERSION=`echo ${JAVA_VERSION} | awk '{split($0, array, ".")} END{print array[2]}'`
if [[ ${JAVA_MINOR_VERSION} -ne 8 ]]; then if [[ ${JAVA_MAJOR_VERSION} -ne 1 ]] || [[ ${JAVA_MINOR_VERSION} -ne 8 ]]; then
echo "Require a Java JRE in version 1.8, but found ${JAVA_VERSION}. You can override your default JAVA_HOME in 'env.sh'." echo "Require a Java JRE in version 1.8, but found ${JAVA_VERSION}. You can override your default JAVA_HOME in '.local/env.sh'."
exit -1 exit 1
fi fi
echo "Java: $JAVA_VERSION" echo "Java: $JAVA_VERSION"
...@@ -77,11 +79,11 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -77,11 +79,11 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
. $NVM_DIR/nvm.sh . $NVM_DIR/nvm.sh
nvm use 5 nvm use 5
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
exit -1 exit 1
fi fi
else else
echo "nvm (Node version manager) not found (directory $NVM_DIR not found). Please install, and retry" echo "nvm (Node version manager) not found (directory $NVM_DIR not found). Please install, and retry"
exit -1 exit 1
fi fi
# Update config file # Update config file
...@@ -98,7 +100,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -98,7 +100,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
rm -rf platforms/android/build/outputs/release/* rm -rf platforms/android/build/outputs/release/*
ionic build android --release ionic build android --release
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
exit -1 exit 1
fi fi
echo "----------------------------------" echo "----------------------------------"
...@@ -109,7 +111,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -109,7 +111,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
gulp config --env default gulp config --env default
gulp build:web --release gulp build:web --release
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
exit -1 exit 1
fi fi
echo "----------------------------------" echo "----------------------------------"
...@@ -124,7 +126,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -124,7 +126,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
git tag "v$2" git tag "v$2"
git push git push
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
exit -1 exit 1
fi fi
# Pause (wait propagation to from git.duniter.org to github) # Pause (wait propagation to from git.duniter.org to github)
...@@ -142,7 +144,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -142,7 +144,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
./github.sh $1 ''"$description"'' ./github.sh $1 ''"$description"''
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
exit -1 exit 1
fi fi
echo "----------------------------------" echo "----------------------------------"
...@@ -159,7 +161,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -159,7 +161,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
# Build desktop assets # Build desktop assets
./release.sh $2 ./release.sh $2
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
exit -1 exit 1
fi fi
else else
echo "WARN: platform/desktop not found -> Skipping desktop build!" echo "WARN: platform/desktop not found -> Skipping desktop build!"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment