From 95724a3394b794e67d3899b4d1e7e255e4f89169 Mon Sep 17 00:00:00 2001 From: GambleCodez Affiliates Date: Sun, 22 Feb 2026 19:15:50 -0600 Subject: [PATCH] Revert "Claude/update prod runner script lq2g s (#62)" This reverts commit 5168fb79b29ce8ea0a1d2e9fbf03081ac0ce794c. --- deploy.sh | 11 +---------- index.js | 14 ++++---------- prod-run.sh | 12 +++++------- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/deploy.sh b/deploy.sh index 3478e54..4b54587 100755 --- a/deploy.sh +++ b/deploy.sh @@ -29,20 +29,11 @@ say "Date: $(date -u '+%Y-%m-%dT%H:%M:%SZ')" cd "$PROJECT_DIR" # --------------------------------------------------------- -# 0) Stop service before touching files (prevents file locks) -# --------------------------------------------------------- -if command -v systemctl >/dev/null 2>&1; then - say "Step 0/4 — Stopping ${APP_NAME} service…" - systemctl stop "${APP_NAME}.service" || true -fi - -# --------------------------------------------------------- -# 1) Pull latest code from origin/main (hard reset — no merge conflicts) +# 1) Pull latest code from origin/main # --------------------------------------------------------- say "Step 1/4 — Fetching latest code from origin/main…" git fetch --all git reset --hard origin/main -git clean -fd say "Now at: $(git rev-parse --short HEAD)" # --------------------------------------------------------- diff --git a/index.js b/index.js index d70b14f..3667184 100644 --- a/index.js +++ b/index.js @@ -2526,17 +2526,11 @@ bot.command('deploy', async (ctx) => { .editMessageText(ctx.chat.id, status.message_id, null, text, { parse_mode: 'Markdown' }) .catch(() => {}); - // ── Step 1: fetch + hard reset (avoids hang on dirty tree / merge conflicts) ── - const fetchResult = await runCmd('git', ['fetch', '--all'], PROJECT_DIR, 30000); - const gitResult = fetchResult.ok - ? await runCmd('git', ['reset', '--hard', 'origin/main'], PROJECT_DIR, 15000) - : fetchResult; - if (gitResult.ok) { - await runCmd('git', ['clean', '-fd'], PROJECT_DIR, 10000).catch(() => {}); - } + // ── Step 1: git pull ────────────────────────────────────────── + const gitResult = await runCmd('git', ['pull', 'origin', 'main'], PROJECT_DIR, 30000); const gitLine = gitResult.ok - ? `✅ *git update:* \`${sanitizeCmdOutput(gitResult.out.split('\n')[0])}\`` - : `⚠️ *git update failed:* \`${sanitizeCmdOutput(gitResult.err || fetchResult.err)}\``; + ? `✅ *git pull:* \`${sanitizeCmdOutput(gitResult.out.split('\n')[0])}\`` + : `⚠️ *git pull failed:* \`${sanitizeCmdOutput(gitResult.err)}\``; await edit( `🚀 *Deployment in progress* — ${ts()}\n\n` diff --git a/prod-run.sh b/prod-run.sh index 6f29904..2a6586f 100755 --- a/prod-run.sh +++ b/prod-run.sh @@ -38,15 +38,13 @@ say "Project directory: $PROJECT_DIR" say "Running as: $(id -un) (uid=$(id -u) gid=$(id -g))" # --------------------------------------------------------- -# 1) Fetch + hard reset to origin/main [FIRST — before anything] -# Using fetch+reset instead of pull avoids hangs on dirty trees / conflicts. +# 1) Pull latest code from origin main [FIRST — before anything] # --------------------------------------------------------- -say "Fetching latest code from origin main..." -if git -C "$PROJECT_DIR" fetch --all 2>&1 && git -C "$PROJECT_DIR" reset --hard origin/main 2>&1; then - git -C "$PROJECT_DIR" clean -fd 2>&1 || true - say "Git fetch + reset successful: $(git -C "$PROJECT_DIR" rev-parse --short HEAD)" +say "Pulling latest code from origin main..." +if git -C "$PROJECT_DIR" pull origin main 2>&1; then + say "Git pull successful" else - warn "Git fetch/reset failed — continuing with local copy" + warn "Git pull failed — continuing with local copy" fi # ---------------------------------------------------------