From 7a934ca52b21b0f0120d055bf956acd87ea8d14a Mon Sep 17 00:00:00 2001 From: anmol26s Date: Sat, 6 Mar 2021 02:08:14 +0530 Subject: [PATCH] Use git for source and remove verbose --- scripts/install | 9 +++++++-- scripts/upgrade | 9 ++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index f4cce8f..9bf4362 100755 --- a/scripts/install +++ b/scripts/install @@ -34,6 +34,7 @@ password=$YNH_APP_ARG_PASSWORD dav_support=$YNH_APP_ARG_DAV_SUPPORT signup=$YNH_APP_ARG_SIGNUP two_factor=$YNH_APP_ARG_TWO_FACTOR +version=$(curl -s https://api.github.com/repos/monicahq/monica/releases/latest | grep 'tag_name' | cut -d\" -f4) app=$YNH_APP_INSTANCE_NAME @@ -62,6 +63,7 @@ ynh_app_setting_set --app=$app --key=random_key --value=$random_key ynh_app_setting_set --app=$app --key=dav_support --value=$dav_support ynh_app_setting_set --app=$app --key=signup --value=$signup ynh_app_setting_set --app=$app --key=two_factor --value=$two_factor +ynh_app_setting_set --app=$app --key=version --value=$version #================================================= # STANDARD MODIFICATIONS @@ -89,7 +91,10 @@ ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +git clone https://github.com/monicahq/monica.git $final_path +pushd "$final_path" + git checkout tags/$version +popd #================================================= # NGINX CONFIGURATION @@ -175,7 +180,7 @@ fi ynh_script_progression --message="Deploying..." pushd "$final_path" - php$phpversion artisan setup:production --email=$email --password=$password -vvv -n --force + php$phpversion artisan setup:production --email=$email --password=$password -n --force php$phpversion artisan passport:client --password -n > key.txt mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- ) mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- ) diff --git a/scripts/upgrade b/scripts/upgrade index 8a3372e..7c7dba4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,6 +31,8 @@ email=$(ynh_user_get_info --username=$admin --key=mail) dav_support=$(ynh_app_setting_get --app=$app --key=dav_support) signup=$(ynh_app_setting_get --app=$app --key=signup) two_factor=$(ynh_app_setting_get --app=$app --key=two_factor) +version=$(curl -s https://api.github.com/repos/monicahq/monica/releases/latest | grep 'tag_name' | cut -d\" -f4) + #================================================= # CHECK VERSION @@ -98,8 +100,13 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + pushd "$final_path" + git fetch + git checkout tags/$version + popd + fi +ynh_app_setting_set --app=$app --key=version --value=$version #================================================= # NGINX CONFIGURATION