diff --git a/.gitattributes b/.gitattributes index 7924e0f..32e170b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19,3 +19,4 @@ /serve.bat export-ignore /phpstan.neon export-ignore /phpunit.xml export-ignore +/aapanel_deploy.sh export-ignore \ No newline at end of file diff --git a/aapanel_deploy.sh b/aapanel_deploy.sh new file mode 100644 index 0000000..185ed88 --- /dev/null +++ b/aapanel_deploy.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# aaPanel Webhook Deployment Script for Mivo +# Path: /www/wwwroot/ + +PROJECT_PATH="/www/wwwroot/" + +echo "---------------------------------------" +echo "Starting Deployment: $(date)" +echo "---------------------------------------" + +if [ ! -d "$PROJECT_PATH" ]; then + echo "Error: Project directory $PROJECT_PATH not found." + exit 1 +fi + +cd $PROJECT_PATH || exit + +# 1. Pull latest changes +echo "Step 1: Pulling latest changes from Git..." +git pull origin main # Adjust branch name if necessary + +# 2. Install PHP dependencies +if [ -f "composer.json" ]; then + echo "Step 2: Installing PHP dependencies..." + composer install --no-interaction --optimize-autoloader --no-dev +fi + +# 3. Build Assets +if [ -f "package.json" ]; then + echo "Step 3: Building assets..." + # If node_modules doesn't exist, install first + if [ ! -d "node_modules" ]; then + npm install + fi + npm run build +fi + +# 4. Set Permissions +echo "Step 4: Setting permissions..." +chown -R www:www . +chmod +x mivo +chmod -R 755 public +# If there's a storage directory (MVC style usually has one) +if [ -d "storage" ]; then + chmod -R 775 storage +fi + +echo "---------------------------------------" +echo "Deployment Finished Successfully!" +echo "---------------------------------------"