56 lines
1.4 KiB
Bash
56 lines
1.4 KiB
Bash
#!/bin/bash
|
|
|
|
# LuckyChit Flutter Web Deployment Script
|
|
# Quick script to rebuild and deploy web changes
|
|
|
|
echo "🚀 Deploying Flutter Web Updates"
|
|
echo "================================="
|
|
echo ""
|
|
|
|
# Check if we're in the right directory
|
|
if [ ! -f "pubspec.yaml" ]; then
|
|
echo "❌ Error: pubspec.yaml not found!"
|
|
echo "Please run this script from the luckychit directory"
|
|
exit 1
|
|
fi
|
|
|
|
# Clean previous build
|
|
echo "🧹 Cleaning previous build..."
|
|
flutter clean
|
|
|
|
# Get dependencies
|
|
echo "📦 Getting dependencies..."
|
|
flutter pub get
|
|
|
|
# Build for production
|
|
echo "🔨 Building for web (production mode)..."
|
|
echo " This may take a few minutes..."
|
|
flutter build web --release
|
|
|
|
# Check if build was successful
|
|
if [ $? -eq 0 ]; then
|
|
echo ""
|
|
echo "✅ Build successful!"
|
|
echo ""
|
|
echo "📁 Build output location: build/web/"
|
|
echo ""
|
|
echo "📤 Next steps to deploy:"
|
|
echo ""
|
|
echo "Option 1 - nginx (Recommended):"
|
|
echo " sudo cp -r build/web/* /var/www/luckychit/"
|
|
echo " sudo systemctl restart nginx"
|
|
echo ""
|
|
echo "Option 2 - PM2 with Express:"
|
|
echo " pm2 restart luckychit-web"
|
|
echo ""
|
|
echo "Option 3 - Upload to server:"
|
|
echo " scp -r build/web/* user@server:/var/www/luckychit/"
|
|
echo ""
|
|
echo "💡 Tip: Users may need to clear browser cache (Ctrl+Shift+R)"
|
|
else
|
|
echo ""
|
|
echo "❌ Build failed! Please check the errors above."
|
|
exit 1
|
|
fi
|
|
|