From 8238f425be5f03d568041ea70f192d50f05dafe1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Feb 2021 18:50:13 +0100 Subject: [PATCH] Update upgrade --- scripts/upgrade | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 896e70d..a27317a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,15 +73,26 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=5 - # Remove the app directory securely - ynh_secure_remove --file=$final_path - git clone https://github.com/iv-org/invidious "$final_path" --quiet - pushd "$final_path" || ynh_die - shards update && shards install - crystal build src/invidious.cr --release +pushd $final_path + currentVersion=$(git rev-list --max-count=1 --abbrev-commit HEAD) + git pull + latestVersion=$(git describe --tags --abbrev=0) + git checkout $latestVersion + for i in `git rev-list --reverse --abbrev-commit $currentVersion..HEAD` ; do file=./config/migrate-scripts/migrate-db-$i.sh ; [ -f $file ] && $file ; done + shards update && shards install + crystal build src/invidious.cr --release popd || ynh_die fi +# # Remove the app directory securely +# ynh_secure_remove --file=$final_path +# git clone https://github.com/iv-org/invidious "$final_path" --quiet +# pushd "$final_path" || ynh_die +# shards update && shards install +# crystal build src/invidious.cr --release +# popd || ynh_die +# fi + #================================================= # NGINX CONFIGURATION #=================================================