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

[fix] Minor changes

parent f976ece1
No related branches found
No related tags found
No related merge requests found
Pipeline #7117 passed with warnings
...@@ -76,7 +76,7 @@ case "$1" in ...@@ -76,7 +76,7 @@ case "$1" in
echo " - tag: v$current" echo " - tag: v$current"
echo " - description: $description" 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"'}'` 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/.-]+"` upload_url=`echo "$result" | grep -P "\"upload_url\": \"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+"`
if [[ "_$upload_url" = "_" ]]; then if [[ "_$upload_url" = "_" ]]; then
...@@ -87,7 +87,7 @@ case "$1" in ...@@ -87,7 +87,7 @@ case "$1" in
fi fi
### Sending files ### Sending files
echo "Uploading files to ${upload_url}" echo "Uploading files to ${upload_url} ..."
dirname=$(pwd) dirname=$(pwd)
ZIP_FILE="$dirname/platforms/web/build/${PROJECT_NAME}-v$current-web.zip" ZIP_FILE="$dirname/platforms/web/build/${PROJECT_NAME}-v$current-web.zip"
......
...@@ -26,162 +26,162 @@ if [[ "_$currentAndroid" == "_" ]]; then ...@@ -26,162 +26,162 @@ if [[ "_$currentAndroid" == "_" ]]; then
fi fi
echo "Current Android version: $currentAndroid" echo "Current Android version: $currentAndroid"
# Check version format
if [[ ! $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ || ! $3 =~ ^[0-9]+$ ]]; then
echo "Wrong version format"
echo "Usage:"
echo " > ./release.sh [pre|rel] <version> <android-version> <release_description>"
echo "with:"
echo " - pre: use for pre-release"
echo " - rel: for full release"
echo " - version: x.y.z"
echo " - android-version: nnn"
echo " - release_description: a comment on release"
exit 1
fi
### Releasing echo "new build version: $2"
if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then echo "new build android version: $3"
case "$1" in
echo "new build version: $2" rel|pre)
echo "new build android version: $3" # Change the version in files: 'package.json' and 'config.xml'
case "$1" in sed -i "s/version\": \"$current\"/version\": \"$2\"/g" package.json
rel|pre) currentConfigXmlVersion=`grep -oP "version=\"\d+.\d+.\d+((a|b)[0-9]+)?\"" config.xml | grep -oP "\d+.\d+.\d+((a|b)[0-9]+)?"`
# Change the version in files: 'package.json' and 'config.xml' sed -i "s/ version=\"$currentConfigXmlVersion\"/ version=\"$2\"/g" config.xml
sed -i "s/version\": \"$current\"/version\": \"$2\"/g" package.json sed -i "s/ android-versionCode=\"$currentAndroid\"/ android-versionCode=\"$3\"/g" config.xml
currentConfigXmlVersion=`grep -oP "version=\"\d+.\d+.\d+((a|b)[0-9]+)?\"" config.xml | grep -oP "\d+.\d+.\d+((a|b)[0-9]+)?"`
sed -i "s/ version=\"$currentConfigXmlVersion\"/ version=\"$2\"/g" config.xml # Change version in file: 'www/manifest.json'
sed -i "s/ android-versionCode=\"$currentAndroid\"/ android-versionCode=\"$3\"/g" config.xml currentManifestJsonVersion=`grep -oP "version\": \"\d+.\d+.\d+((a|b)[0-9]+)?\"" www/manifest.json | grep -oP "\d+.\d+.\d+((a|b)[0-9]+)?"`
sed -i "s/version\": \"$currentManifestJsonVersion\"/version\": \"$2\"/g" www/manifest.json
# Change version in file: 'www/manifest.json'
currentManifestJsonVersion=`grep -oP "version\": \"\d+.\d+.\d+((a|b)[0-9]+)?\"" www/manifest.json | grep -oP "\d+.\d+.\d+((a|b)[0-9]+)?"` # Bump the install.sh
sed -i "s/version\": \"$currentManifestJsonVersion\"/version\": \"$2\"/g" www/manifest.json sed -i "s/echo \"v.*\" #lastest/echo \"v$2\" #lastest/g" install.sh
;;
# Bump the install.sh *)
sed -i "s/echo \"v.*\" #lastest/echo \"v$2\" #lastest/g" install.sh echo "No task given"
;;
*)
echo "No task given"
exit 1
;;
esac
# Load env.sh if exists
if [[ -f "${DIRNAME}/.local/env.sh" ]]; then
echo "Loading .local/env.sh ..."
source "${DIRNAME}/.local/env.sh" $*
fi
# Check the Java version
JAVA_VERSION=`java -version 2>&1 | egrep "(java|openjdk) version" | awk '{print $3}' | tr -d \"`
if [[ $? -ne 0 ]]; then
echo "No Java JRE 1.8 found in machine. This is required for Android artifacts."
exit 1 exit 1
fi ;;
JAVA_MAJOR_VERSION=`echo ${JAVA_VERSION} | awk '{split($0, array, ".")} END{print array[1]}'` esac
JAVA_MINOR_VERSION=`echo ${JAVA_VERSION} | awk '{split($0, array, ".")} END{print array[2]}'`
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 '.local/env.sh'."
exit 1
fi
echo "Java: $JAVA_VERSION"
# force nodejs version to 6 # Load env.sh if exists
if [[ -d "$NVM_DIR" ]]; then if [[ -f "${DIRNAME}/.local/env.sh" ]]; then
. $NVM_DIR/nvm.sh echo "Loading .local/env.sh ..."
nvm use 6 source "${DIRNAME}/.local/env.sh" $*
if [[ $? -ne 0 ]]; then fi
exit 1
fi
else
echo "nvm (Node version manager) not found (directory $NVM_DIR not found). Please install, and retry"
exit 1
fi
# Update config file # Check the Java version
gulp config --env default_fr JAVA_VERSION=`java -version 2>&1 | egrep "(java|openjdk) version" | awk '{print $3}' | tr -d \"`
if [[ $? -ne 0 ]]; then
echo "No Java JRE 1.8 found in machine. This is required for Android artifacts."
exit 1
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]}'`
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 '.local/env.sh'."
exit 1
fi
echo "Java: $JAVA_VERSION"
echo "----------------------------------"
echo "- Compiling sources..."
echo "----------------------------------"
gulp
echo "----------------------------------" # force nodejs version to 6
echo "- Building Android artifact..." if [[ -d "$NVM_DIR" ]]; then
echo "----------------------------------" . $NVM_DIR/nvm.sh
rm -rf platforms/android/build/outputs/release/* nvm use 6
ionic build android --release
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
exit 1 exit 1
fi fi
else
echo "nvm (Node version manager) not found (directory $NVM_DIR not found). Please install, and retry"
exit 1
fi
echo "----------------------------------" # Update config file
echo "- Building web artifact..." gulp config --env default_fr
echo "----------------------------------"
# Update config file echo "----------------------------------"
gulp config --env default echo "- Compiling sources..."
gulp build:web --release echo "----------------------------------"
if [[ $? -ne 0 ]]; then gulp
exit 1
fi
echo "----------------------------------" echo "----------------------------------"
echo "- Executing git push, with tag: v$2" echo "- Building Android artifact..."
echo "----------------------------------" echo "----------------------------------"
rm -rf platforms/android/build/outputs/release/*
# Commit ionic build android --release
cd $DIRNAME if [[ $? -ne 0 ]]; then
git reset HEAD exit 1
git add package.json config.xml install.sh www/js/config.js www/manifest.json fi
git commit -m "v$2"
git tag "v$2"
git push
if [[ $? -ne 0 ]]; then
exit 1
fi
# Pause (wait propagation to from git.duniter.org to github) echo "----------------------------------"
echo " Waiting 30s, for propagation to github..." echo "- Building web artifact..."
sleep 30s echo "----------------------------------"
description="$4" # Update config file
if [[ "_$description" == "_" ]]; then gulp config --env default
description="Release v$2" gulp build:web --release
fi if [[ $? -ne 0 ]]; then
exit 1
fi
echo "**********************************" echo "----------------------------------"
echo "* Uploading artifacts to Github..." echo "- Executing git push, with tag: v$2"
echo "**********************************" echo "----------------------------------"
# Commit
cd $DIRNAME
git reset HEAD
git add package.json config.xml install.sh www/js/config.js www/manifest.json
git commit -m "v$2"
git tag "v$2"
git push
if [[ $? -ne 0 ]]; then
exit 1
fi
./github.sh $1 ''"$description"'' # Pause (wait propagation to from git.duniter.org to github)
if [[ $? -ne 0 ]]; then echo " Waiting 30s, for propagation to github..."
exit 1 sleep 40s
fi
echo "----------------------------------" description="$4"
echo "- Building desktop artifacts..." if [[ "_$description" == "_" ]]; then
echo "----------------------------------" description="Release v$2"
fi
git submodule init echo "**********************************"
git submodule sync echo "* Uploading artifacts to Github..."
git submodule update --remote --merge echo "**********************************"
if [[ -d "$DIRNAME/platforms/desktop" ]]; then ./github.sh $1 ''"$description"''
cd platforms/desktop if [[ $? -ne 0 ]]; then
exit 1
fi
# Build desktop assets echo "----------------------------------"
./release.sh $2 echo "- Building desktop artifacts..."
if [[ $? -ne 0 ]]; then echo "----------------------------------"
exit 1
fi
else
echo "WARN: platform/desktop not found -> Skipping desktop build!"
fi;
# back to nodejs version 6 git submodule init
cd $DIRNAME git submodule sync
nvm use 6 git submodule update --remote --merge
echo "**********************************" if [[ -d "$DIRNAME/platforms/desktop" ]]; then
echo "* Build release succeed !" cd platforms/desktop
echo "**********************************"
# Build desktop assets
./release.sh $2
if [[ $? -ne 0 ]]; then
exit 1
fi
else else
echo "Wrong version format" echo "WARN: platform/desktop not found -> Skipping desktop build!"
echo "Usage:" fi;
echo " > ./release.sh [pre|rel] <version> <android-version> <release_description>"
echo "with:" # back to nodejs version 6
echo " version: x.y.z" cd $DIRNAME
echo " android-version: nnn" nvm use 6
echo " release_description: a short description of the release"
fi echo "**********************************"
echo "* Build release succeed !"
echo "**********************************"
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