diff --git a/deploy.sh b/deploy.sh index 49074a8..a82d241 100755 --- a/deploy.sh +++ b/deploy.sh @@ -39,14 +39,16 @@ fi # --- Common: ensure repo exists, pull + build --- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -if [ ! -d "$REPO_DIR/.git" ]; then +if [ ! -d "$REPO_DIR" ]; then echo "[1/6] Cloning repository..." git clone "$REPO_URL" "$REPO_DIR" -else +elif [ -d "$REPO_DIR/.git" ]; then echo "[1/6] Pulling latest code..." cd "$REPO_DIR" && git pull +else + echo "[1/6] Using existing code..." fi -cd "$REPO_DIR" +cd "$REPO_DIR" 2>/dev/null || mkdir -p "$REPO_DIR" echo "[2/6] Building binary and helper tool..." export PATH=$PATH:/usr/local/go/bin