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

[fix] Fix release script

parent ae8484e9
No related branches found
No related tags found
No related merge requests found
Pipeline #3085 passed
...@@ -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 exit -1
fi fi
...@@ -25,7 +25,7 @@ else ...@@ -25,7 +25,7 @@ else
echo "Unable to find github authentifcation token file: " echo "Unable to find github authentifcation token file: "
echo " - You can create such a token at https://github.com/settings/tokens > 'Generate a new token'." echo " - You can create such a token at https://github.com/settings/tokens > 'Generate a new token'."
echo " - Then copy the token and paste it in the file '~/.config/duniter/.github' using a valid token." echo " - Then copy the token and paste it in the file '~/.config/duniter/.github' using a valid token."
exit exit -1
fi fi
case "$1" in case "$1" in
...@@ -46,7 +46,7 @@ case "$1" in ...@@ -46,7 +46,7 @@ case "$1" in
else else
prerelease="false" prerelease="false"
fi fi
description=`echo $2` description="$2"
result=`curl -s -H ''"$GITHUT_AUTH"'' "$REPO_URL/releases/tags/v$current"` result=`curl -s -H ''"$GITHUT_AUTH"'' "$REPO_URL/releases/tags/v$current"`
release_url=`echo "$result" | grep -P "\"url\": \"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+/releases/\d+"` release_url=`echo "$result" | grep -P "\"url\": \"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+/releases/\d+"`
...@@ -56,7 +56,7 @@ case "$1" in ...@@ -56,7 +56,7 @@ case "$1" in
if [[ "_$result" != "_" ]]; then if [[ "_$result" != "_" ]]; then
error_message=`echo "$result" | grep -P "\"message\": \"[^\"]+" | grep -oP ": \"[^\"]+\""` error_message=`echo "$result" | grep -P "\"message\": \"[^\"]+" | grep -oP ": \"[^\"]+\""`
echo "Delete existing release failed with error$error_message" echo "Delete existing release failed with error$error_message"
exit exit -1
fi fi
else else
echo "Release not exists yet on github." echo "Release not exists yet on github."
...@@ -84,11 +84,12 @@ case "$1" in ...@@ -84,11 +84,12 @@ case "$1" in
echo "With:" echo "With:"
echo " - pre: use for pre-release" echo " - pre: use for pre-release"
echo " - rel: for full release" echo " - rel: for full release"
exit exit -1
fi fi
;; ;;
*) *)
echo "No task given" echo "No task given"
exit -1
;; ;;
esac esac
......
...@@ -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 exit -1
fi fi
DIRNAME=`pwd` DIRNAME=`pwd`
...@@ -37,6 +37,7 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -37,6 +37,7 @@ 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
;; ;;
esac esac
...@@ -49,6 +50,9 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -49,6 +50,9 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
if [ -d "$NVM_DIR" ]; then if [ -d "$NVM_DIR" ]; then
. $NVM_DIR/nvm.sh . $NVM_DIR/nvm.sh
nvm use 5 nvm use 5
if [ $? -ne 0 ]; then
exit -1
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
...@@ -66,8 +70,9 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -66,8 +70,9 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
echo "- Building Android artifact..." echo "- Building Android artifact..."
echo "----------------------------------" echo "----------------------------------"
ionic build android --release ionic build android --release
if [ $? -ne 0 ]; then
#ionic build firefoxos --release exit -1
fi
echo "----------------------------------" echo "----------------------------------"
echo "- Building web artifact..." echo "- Building web artifact..."
...@@ -76,72 +81,71 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then ...@@ -76,72 +81,71 @@ if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ && $3 =~ ^[0-9]+$ ]]; then
# Update config file # Update config file
gulp config --env default gulp config --env default
gulp build:web --release gulp build:web --release
cd $DIRNAME if [ $? -ne 0 ]; then
exit -1
fi
echo "----------------------------------" echo "----------------------------------"
echo "- Executing git push, with tag: v$2" echo "- Executing git push, with tag: v$2"
echo "----------------------------------" echo "----------------------------------"
# Commit # Commit
cd $DIRNAME
git reset HEAD git reset HEAD
git add package.json config.xml install.sh www/js/config.js www/manifest.json git add package.json config.xml install.sh www/js/config.js www/manifest.json
git commit -m "v$2" git commit -m "v$2"
git tag "v$2" git tag "v$2"
git push git push
if [ $? -ne 0 ]; then
exit -1
fi
# Pause (wait propagation to from git.duniter.org to github) # Pause (wait propagation to from git.duniter.org to github)
echo " Waiting 30s, for propagation to github..." echo " Waiting 30s, for propagation to github..."
sleep 30s sleep 30s
if [[ "_$4" != "_" ]]; then description="$4"
echo "**********************************" if [[ "_$description" == "_" ]]; then
echo "* Uploading artifacts to Github..." description="Release v$1"
echo "**********************************" fi
echo "**********************************"
echo "* Uploading artifacts to Github..."
echo "**********************************"
./github.sh $1 ''"$4"'' ./github.sh $1 ''"$description"''
if [ $? -ne 0 ]; then
exit -1
fi
echo "----------------------------------" echo "----------------------------------"
echo "- Building desktop versions..." echo "- Building desktop versions..."
echo "----------------------------------" echo "----------------------------------"
# Remove old vagrant virtual machines # Remove old vagrant virtual machines
rm -rf ~/.vagrant.d/* rm -rf ~/.vagrant.d/*
git submodule update --init git submodule update --init
git submodule sync git submodule sync
cd platforms/desktop cd platforms/desktop
# Exclude Windows - TODO FIXME (not enough space in BL directories) # Exclude Windows - TODO FIXME (not enough space in BL directories)
EXPECTED_ASSETS="cesium-desktop-v$2-linux-x64.deb EXPECTED_ASSETS="cesium-desktop-v$2-linux-x64.deb
cesium-desktop-v$2-linux-x64.tar.gz" cesium-desktop-v$2-linux-x64.tar.gz"
export EXPECTED_ASSETS export EXPECTED_ASSETS
./release.sh $2
# back to nodejs version 5 ./release.sh $2
cd $DIRNAME if [ $? -ne 0 ]; then
nvm use 5 exit -1
fi
echo "**********************************" # back to nodejs version 5
echo "* Build release succeed !" cd $DIRNAME
echo "**********************************" nvm use 5
else
echo "**********************************" echo "**********************************"
echo "* Build release succeed !" echo "* Build release succeed !"
echo "**********************************" echo "**********************************"
echo " WARN - missing arguments 'release_description'"
echo
echo " Binaries files NOT sending to github repository"
echo " Please run:"
echo " > ./github.sh pre|rel 'release_description'"
echo
echo " Desktop artifact are NOT build"
echo " Please run:"
echo " > platforms/desktop/release.sh <version>"
echo
fi
else else
echo "Wrong version format" echo "Wrong version format"
......
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