diff --git a/ct/investbrain.sh b/ct/investbrain.sh index 957ab6a2c..8ca359314 100644 --- a/ct/investbrain.sh +++ b/ct/investbrain.sh @@ -31,7 +31,7 @@ function update_script() { PG_VERSION="17" setup_postgresql - if check_for_gh_release "investbrain" "investbrainapp/investbrain"; then + if check_for_gh_release "Investbrain" "investbrainapp/investbrain"; then msg_info "Stopping Services" systemctl stop nginx systemctl stop php8.4-fpm @@ -45,11 +45,10 @@ function update_script() { cp -r /opt/investbrain/storage /opt/storage.backup msg_ok "Created Backup" - RELEASE=$(curl -fsSL https://api.github.com/repos/investbrainapp/investbrain/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - msg_info "Updating Investbrain to $RELEASE" + msg_info "Updating Investbrain" rm -rf /opt/investbrain-new mkdir -p /opt/investbrain-new - curl -fsSL "https://github.com/investbrainapp/investbrain/archive/refs/tags/v${RELEASE}.tar.gz" | tar -xz --strip-components=1 -C /opt/investbrain-new + fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain-new" cd /opt/investbrain cp -r /opt/investbrain-new/* /opt/investbrain/ @@ -89,7 +88,6 @@ function update_script() { chown -R www-data:www-data /opt/investbrain chmod -R 755 /opt/investbrain/storage /opt/investbrain/bootstrap/cache - echo "${RELEASE}" >/root/.investbrain rm -rf /opt/.env.backup /opt/storage.backup msg_ok "Updated Investbrain" diff --git a/install/investbrain-install.sh b/install/investbrain-install.sh index 7fc57d345..8c5dc356f 100644 --- a/install/investbrain-install.sh +++ b/install/investbrain-install.sh @@ -33,11 +33,9 @@ NODE_VERSION="22" setup_nodejs PG_VERSION="17" setup_postgresql PG_DB_NAME="investbrain" PG_DB_USER="investbrain" setup_postgresql_db -msg_info "Setting up Investbrain" -RELEASE=$(curl -fsSL https://api.github.com/repos/investbrainapp/investbrain/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Installing Investbrain" mkdir -p /opt/investbrain -cd /opt/investbrain -curl -fsSL "https://github.com/investbrainapp/investbrain/archive/refs/tags/v${RELEASE}.tar.gz" | tar -xz --strip-components=1 +fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain" LOCAL_IP=$(hostname -I | awk '{print $1}') APP_KEY=$(openssl rand -base64 32) @@ -126,7 +124,6 @@ $STD php artisan event:clear $STD php artisan route:cache chown -R www-data:www-data /opt/investbrain chmod -R 755 /opt/investbrain/bootstrap/cache -echo "${RELEASE}" >/opt/investbrain_version.txt msg_ok "Cleared and Cached" msg_info "Configuring Nginx"