From adffd851ed6cd51f72f8c7419f6c100585e506f9 Mon Sep 17 00:00:00 2001 From: mwpn Date: Thu, 18 Dec 2025 11:24:47 +0700 Subject: [PATCH] Add pull scripts untuk update di server production --- README.md | 24 ++++++++++++++++++++++++ pull.bat | 40 ++++++++++++++++++++++++++++++++++++++++ pull.sh | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 pull.bat create mode 100644 pull.sh diff --git a/README.md b/README.md index 5cdcc9b..c6749d8 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,27 @@ Deploy ke web server (Apache/Nginx) dengan konfigurasi: - Base URL: sesuai dengan domain production - API Base URL: otomatis terdeteksi dari hostname +### Update di Server Production + +**Cara 1: Menggunakan Script (Recommended)** +```bash +# Linux/Unix +cd /path/to/retribusi-frontend +bash pull.sh + +# Windows +cd C:\path\to\retribusi-frontend +pull.bat +``` + +**Cara 2: Command Langsung (Sekali Jalan)** +```bash +cd /path/to/retribusi-frontend && git stash && git pull origin main && git stash pop +``` + +**Cara 3: Manual** +```bash +cd /path/to/retribusi-frontend +git pull origin main +``` + diff --git a/pull.bat b/pull.bat new file mode 100644 index 0000000..c7d8cc1 --- /dev/null +++ b/pull.bat @@ -0,0 +1,40 @@ +@echo off +REM Script untuk pull frontend di server production (Windows) +REM Usage: pull.bat + +echo Pulling Retribusi Frontend... +cd /d "%~dp0" + +REM Cek apakah ini git repository +if not exist ".git" ( + echo Error: Bukan git repository + exit /b 1 +) + +REM Cek branch saat ini +for /f "tokens=2" %%b in ('git branch --show-current 2^>nul') do set CURRENT_BRANCH=%%b +echo Current branch: %CURRENT_BRANCH% + +REM Stash perubahan lokal jika ada +echo Stashing local changes (if any)... +git stash + +REM Pull dari origin main +echo Pulling from origin/main... +git pull origin main + +REM Jika ada stash, coba pop (optional) +git stash list >nul 2>&1 +if %errorlevel% equ 0 ( + echo Restoring stashed changes... + git stash pop + if %errorlevel% neq 0 ( + echo Warning: Ada conflict saat restore stash, silakan resolve manual + ) +) + +echo Pull selesai! +echo. +echo Status: +git status --short + diff --git a/pull.sh b/pull.sh new file mode 100644 index 0000000..1b550fe --- /dev/null +++ b/pull.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Script untuk pull frontend di server production +# Usage: bash pull.sh + +echo "🔄 Pulling Retribusi Frontend..." +cd "$(dirname "$0")" || exit + +# Cek apakah ini git repository +if [ ! -d ".git" ]; then + echo "❌ Error: Bukan git repository" + exit 1 +fi + +# Cek branch saat ini +CURRENT_BRANCH=$(git branch --show-current) +echo "📍 Current branch: $CURRENT_BRANCH" + +# Stash perubahan lokal jika ada (untuk openapi.json atau file lain yang mungkin berubah) +echo "💾 Stashing local changes (if any)..." +git stash + +# Pull dari origin main +echo "⬇️ Pulling from origin/main..." +git pull origin main + +# Jika ada stash, coba pop (optional) +if git stash list | grep -q .; then + echo "📦 Restoring stashed changes..." + git stash pop || echo "⚠️ Warning: Ada conflict saat restore stash, silakan resolve manual" +fi + +echo "✅ Pull selesai!" +echo "" +echo "📊 Status:" +git status --short +