Enhance auto-deploy script for Flutter frontend by ensuring a clean build environment and fetching packages

This commit is contained in:
Leon Bösche
2026-02-01 01:19:45 +01:00
parent c0bbf378f3
commit 14b5eb1c31

View File

@@ -62,6 +62,12 @@ echo "=== Deploying Frontend ==="
echo "Building Flutter web app..."
FRONTEND_DIR="$DEPLOY_DIR/b0esche_cloud"
cd "$FRONTEND_DIR"
# Ensure a clean build environment to avoid stale package config or .dart_tool cache
sudo -u admin rm -rf .dart_tool build
# Fetch packages and clean previous artifacts
timeout 300 sudo -u admin /opt/flutter/bin/flutter pub get
sudo -u admin /opt/flutter/bin/flutter clean
# Now build
timeout 900 sudo -u admin /opt/flutter/bin/flutter build web --release || {
echo "Flutter build failed or timed out"
exit 1