Add pull scripts untuk update di server production
This commit is contained in:
24
README.md
24
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
|
||||
```
|
||||
|
||||
|
||||
40
pull.bat
Normal file
40
pull.bat
Normal file
@@ -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
|
||||
|
||||
36
pull.sh
Normal file
36
pull.sh
Normal file
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user