mirror of
https://github.com/mivodev/mivo.git
synced 2026-01-26 05:25:42 +07:00
fix: Resolve Git ownership, Composer, and npm environment issues in the deployment script and add cleanup for temporary files.
This commit is contained in:
@@ -17,17 +17,23 @@ cd $PROJECT_PATH || exit
|
|||||||
|
|
||||||
# 1. Pull latest changes
|
# 1. Pull latest changes
|
||||||
echo "Step 1: Pulling latest changes from Git..."
|
echo "Step 1: Pulling latest changes from Git..."
|
||||||
git pull origin main # Adjust branch name if necessary
|
# Fix for dubious ownership error
|
||||||
|
git config --global --add safe.directory $PROJECT_PATH
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
# 2. Install PHP dependencies
|
# 2. Install PHP dependencies
|
||||||
if [ -f "composer.json" ]; then
|
if [ -f "composer.json" ]; then
|
||||||
echo "Step 2: Installing PHP dependencies..."
|
echo "Step 2: Installing PHP dependencies..."
|
||||||
|
# Set COMPOSER_HOME to avoid environment variable errors
|
||||||
|
export COMPOSER_HOME="$PROJECT_PATH/.composer"
|
||||||
composer install --no-interaction --optimize-autoloader --no-dev
|
composer install --no-interaction --optimize-autoloader --no-dev
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 3. Build Assets
|
# 3. Build Assets
|
||||||
if [ -f "package.json" ]; then
|
if [ -f "package.json" ]; then
|
||||||
echo "Step 3: Building assets..."
|
echo "Step 3: Building assets..."
|
||||||
|
# Set HOME for npm/node environment
|
||||||
|
export HOME="$PROJECT_PATH"
|
||||||
# If node_modules doesn't exist, install first
|
# If node_modules doesn't exist, install first
|
||||||
if [ ! -d "node_modules" ]; then
|
if [ ! -d "node_modules" ]; then
|
||||||
npm install
|
npm install
|
||||||
@@ -44,6 +50,10 @@ chmod -R 755 public
|
|||||||
if [ -d "storage" ]; then
|
if [ -d "storage" ]; then
|
||||||
chmod -R 775 storage
|
chmod -R 775 storage
|
||||||
fi
|
fi
|
||||||
|
# Cleanup composer home if created
|
||||||
|
if [ -d ".composer" ]; then
|
||||||
|
rm -rf .composer
|
||||||
|
fi
|
||||||
|
|
||||||
echo "---------------------------------------"
|
echo "---------------------------------------"
|
||||||
echo "Deployment Finished Successfully!"
|
echo "Deployment Finished Successfully!"
|
||||||
|
|||||||
Reference in New Issue
Block a user