#!/usr/bin/env bash

# ==============================================================================
# Git Post-Receive Hook for Auto Deployment
# Place this file in: /var/repo/copy-trade-dashboard.git/hooks/post-receive
# Make executable: chmod +x post-receive
# ==============================================================================

TARGET_DIR="/var/www/copy-trade-dashboard"
GIT_DIR="/var/repo/copy-trade-dashboard.git"

echo "🚀 Deploying code to $TARGET_DIR..."

export GIT_WORK_TREE="$TARGET_DIR"
export GIT_DIR="$GIT_DIR"

git checkout -f main

cd "$TARGET_DIR"
bash deploy.sh
