This commit is contained in:
Dmitry 2025-12-03 03:34:32 +03:00
parent 06b329786d
commit 74164d2749
2 changed files with 30 additions and 6 deletions

View file

@ -504,7 +504,6 @@ jobs:
run: |
echo "🚀 Deploying admin panel..."
cd tools/deploy/admin
chmod +x deploy.sh
./deploy.sh
final-verification:

View file

@ -148,16 +148,41 @@ print_info() {
check_project_root() {
# If we're not in the React project root, try to navigate there
if [ ! -f "package.json" ]; then
# Assume we're running from tools/deploy/admin, navigate to mnemo_cards_admin/web
# Find the project root by searching upwards from the script location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../mnemo_cards_admin/web" && pwd)"
CURRENT_DIR="$SCRIPT_DIR"
if [ -f "$PROJECT_ROOT/package.json" ]; then
# Search upwards up to 5 levels to find mnemo_cards_admin/web/package.json
for i in {1..5}; do
# Check if we're in tools/deploy/admin (relative path)
if [ -f "$CURRENT_DIR/../../../mnemo_cards_admin/web/package.json" ]; then
PROJECT_ROOT="$(cd "$CURRENT_DIR/../../../mnemo_cards_admin/web" && pwd)"
break
fi
# Check if we're in mnemo_cards_admin/web directory directly
if [ -f "$CURRENT_DIR/package.json" ] && [[ "$CURRENT_DIR" == *"mnemo_cards_admin/web" ]]; then
PROJECT_ROOT="$CURRENT_DIR"
break
fi
# Check if current directory contains mnemo_cards_admin/web
if [ -d "$CURRENT_DIR/mnemo_cards_admin/web" ] && [ -f "$CURRENT_DIR/mnemo_cards_admin/web/package.json" ]; then
PROJECT_ROOT="$CURRENT_DIR/mnemo_cards_admin/web"
break
fi
# Move up one directory
CURRENT_DIR="$(dirname "$CURRENT_DIR")"
done
if [ -n "$PROJECT_ROOT" ] && [ -f "$PROJECT_ROOT/package.json" ]; then
print_info "Navigating to React project root: $PROJECT_ROOT"
cd "$PROJECT_ROOT"
else
print_error "Please run this script from the React project root directory (mnemo_cards_admin/web) or from tools/deploy/admin/"
print_error "Could not find package.json at: $PROJECT_ROOT"
print_error "Could not find React project directory (mnemo_cards_admin/web)"
print_error "Searched from: $SCRIPT_DIR"
print_error "Please run this script from within the mnemo_cards project directory"
exit 1
fi
fi