mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 14:06:15 +00:00
fix updater
This commit is contained in:
@ -9,15 +9,14 @@ if [[ -z "${V_PASSWORD}" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${VITO_APP_URL}" ]]; then
|
if [[ -z "${VITO_APP_URL}" ]]; then
|
||||||
export DEFAULT_VITO_APP_URL=http://$(curl https://free.freeipapi.com -4)
|
export DEFAULT_VITO_APP_URL=http://$(curl -s https://free.freeipapi.com -4)
|
||||||
read -p "Enter the APP_URL [$DEFAULT_VITO_APP_URL]: " VITO_APP_URL
|
read -p "Enter the APP_URL [$DEFAULT_VITO_APP_URL]: " VITO_APP_URL
|
||||||
export VITO_APP_URL=${VITO_APP_URL:-$DEFAULT_VITO_APP_URL}
|
export VITO_APP_URL=${VITO_APP_URL:-$DEFAULT_VITO_APP_URL}
|
||||||
echo "APP_URL is set to: $VITO_APP_URL\n"
|
echo "APP_URL is set to: $VITO_APP_URL\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${V_ADMIN_EMAIL}" ]]; then
|
if [[ -z "${V_ADMIN_EMAIL}" ]]; then
|
||||||
echo "Enter your email address:"
|
read -p "Enter admin's email address: " V_ADMIN_EMAIL
|
||||||
read V_ADMIN_EMAIL
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${V_ADMIN_EMAIL}" ]]; then
|
if [[ -z "${V_ADMIN_EMAIL}" ]]; then
|
||||||
@ -26,8 +25,7 @@ if [[ -z "${V_ADMIN_EMAIL}" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${V_ADMIN_PASSWORD}" ]]; then
|
if [[ -z "${V_ADMIN_PASSWORD}" ]]; then
|
||||||
echo "Enter a password for Vito's dashboard:"
|
read -p "Enter a password for the admin user: " V_ADMIN_PASSWORD
|
||||||
read V_ADMIN_PASSWORD
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${V_ADMIN_PASSWORD}" ]]; then
|
if [[ -z "${V_ADMIN_PASSWORD}" ]]; then
|
||||||
@ -182,6 +180,7 @@ cd /home/vito/vito
|
|||||||
git checkout $(git tag -l --merged ${VITO_VERSION} --sort=-v:refname | head -n 1)
|
git checkout $(git tag -l --merged ${VITO_VERSION} --sort=-v:refname | head -n 1)
|
||||||
composer install --no-dev
|
composer install --no-dev
|
||||||
cp .env.prod .env
|
cp .env.prod .env
|
||||||
|
sed -i "s|^APP_URL=.*|APP_URL=${VITO_APP_URL}|" .env
|
||||||
touch /home/vito/vito/storage/database.sqlite
|
touch /home/vito/vito/storage/database.sqlite
|
||||||
php artisan key:generate
|
php artisan key:generate
|
||||||
php artisan storage:link
|
php artisan storage:link
|
||||||
@ -236,6 +235,7 @@ echo "* * * * * cd /home/vito/vito && php artisan schedule:run >> /dev/null 2>&1
|
|||||||
|
|
||||||
# print info
|
# print info
|
||||||
echo "🎉 Congratulations!"
|
echo "🎉 Congratulations!"
|
||||||
|
echo "✅ You can access Vito at: ${VITO_APP_URL}"
|
||||||
echo "✅ SSH User: vito"
|
echo "✅ SSH User: vito"
|
||||||
echo "✅ SSH Password: ${V_PASSWORD}"
|
echo "✅ SSH Password: ${V_PASSWORD}"
|
||||||
echo "✅ Admin Email: ${V_ADMIN_EMAIL}"
|
echo "✅ Admin Email: ${V_ADMIN_EMAIL}"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
echo "Updating Vito..."
|
echo "Updating Vito..."
|
||||||
|
|
||||||
cd /home/vito/vito
|
cd /home/vito/vito
|
||||||
@ -5,10 +7,30 @@ cd /home/vito/vito
|
|||||||
echo "Pulling changes..."
|
echo "Pulling changes..."
|
||||||
git fetch --all
|
git fetch --all
|
||||||
|
|
||||||
echo "Checking out the latest tag..."
|
# Parse release type argument
|
||||||
NEW_RELEASE=$(git tag -l "2.*" --sort=-v:refname | head -n 1)
|
INCLUDE_PRE_RELEASES=""
|
||||||
git checkout "$NEW_RELEASE"
|
|
||||||
|
|
||||||
|
if [[ "$1" == "--alpha" ]]; then
|
||||||
|
INCLUDE_PRE_RELEASES="alpha|beta|rc"
|
||||||
|
elif [[ "$1" == "--beta" ]]; then
|
||||||
|
INCLUDE_PRE_RELEASES="beta|rc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Checking out the latest tag..."
|
||||||
|
|
||||||
|
if [[ -n "$INCLUDE_PRE_RELEASES" ]]; then
|
||||||
|
NEW_RELEASE=$(git tag -l "3.*" | grep -E "$INCLUDE_PRE_RELEASES|^[0-9]+\.[0-9]+\.[0-9]+$" | sort -Vr | head -n 1)
|
||||||
|
else
|
||||||
|
NEW_RELEASE=$(git tag -l "3.*" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -Vr | head -n 1)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$NEW_RELEASE" ]]; then
|
||||||
|
echo "❌ No matching tag found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Switching to tag: $NEW_RELEASE"
|
||||||
|
git checkout "$NEW_RELEASE"
|
||||||
git pull origin "$NEW_RELEASE"
|
git pull origin "$NEW_RELEASE"
|
||||||
|
|
||||||
echo "Installing composer dependencies..."
|
echo "Installing composer dependencies..."
|
||||||
@ -30,4 +52,4 @@ sudo supervisorctl restart worker:*
|
|||||||
|
|
||||||
bash scripts/post-update.sh
|
bash scripts/post-update.sh
|
||||||
|
|
||||||
echo "Vito updated successfully to $NEW_RELEASE! 🎉"
|
echo "✅ Vito updated successfully to $NEW_RELEASE! 🎉"
|
||||||
|
Reference in New Issue
Block a user