Deploy: exdev sync 2026-07-28 09:40:42

This commit is contained in:
Macbook
2026-07-28 09:40:42 +09:00
parent f85e4adc35
commit 1ee28f3a4d
8 changed files with 41 additions and 59 deletions
+15 -31
View File
@@ -9,6 +9,9 @@
# ./server-dev/start-all-server.sh --no-pull # git 동기화 생략
# ./server-dev/start-all-server.sh --no-push # Gitea push 생략
# ./server-dev/start-all-server.sh --local # 로컬 Mac 개발 모드 (local-dev 위임)
#
# 로컬 Mac 실행 시: 현재 소스 → 개발서버(Gitea/exdev)만 반영·배포.
# 공식 GitHub(KoreaExpressWayCorp) push 는 하지 않음 — ./git_fetch_all.sh 전용.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -82,29 +85,8 @@ log() { echo "[$(date '+%H:%M:%S')] $*"; }
fail() { log "ERROR: $*"; exit 1; }
warn() { log "⚠️ $*"; }
sync_github_submodules() {
local tree="$1"
local fetch_script="${tree}/git_fetch_all.sh"
local -a fetch_args=()
if is_exdev_server; then
fetch_args+=(--init)
fi
if [[ ! -x "${fetch_script}" ]]; then
log "git_fetch_all.sh 없음 — submodule GitHub 동기화 생략"
return 0
fi
log "GitHub submodule 최신 동기화 (git_fetch_all.sh)..."
if [[ ${#fetch_args[@]} -gt 0 ]]; then
if ! "${fetch_script}" "${fetch_args[@]}"; then
warn "GitHub submodule 동기화 실패 — ./git_fetch_all.sh 수동 실행"
return 1
fi
elif ! "${fetch_script}"; then
warn "GitHub submodule 동기화 실패 — ./git_fetch_all.sh 수동 실행"
return 1
fi
return 0
}
# 공식 GitHub 동기화/push 는 start-all-server 경로에서 절대 수행하지 않음.
# (과거: git_fetch_all.sh 호출 → 로컬 수정이 공식 GitHub 로 올라가던 문제 방지)
push_source_to_gitea() {
if $NO_PUSH; then
@@ -186,10 +168,8 @@ build_desktop_app() {
}
deploy_from_local_mac() {
log "로컬 Mac → Gitea push → chatbot.exdev.co.kr 배포"
if ! $NO_PULL; then
sync_github_submodules "${ROOT_DIR}" || true
fi
log "로컬 Mac → Gitea(exdev) push → chatbot.exdev.co.kr 배포"
log "공식 GitHub push 생략 (필요 시 ./git_fetch_all.sh)"
build_chatbot_app_for_deploy
push_source_to_gitea
trigger_remote_deploy
@@ -218,19 +198,23 @@ sync_source_from_git() {
fail "브랜치 없음: ${branch} (GIT_DIR=${GIT_DIR})"
fi
git --work-tree="${tree}" --git-dir="${GIT_DIR}" checkout -f "${branch}"
sync_github_submodules "${tree}" || true
# Gitea work tree 만 사용 — 공식 GitHub fetch/push 없음
if [[ -f "${tree}/.gitmodules" ]]; then
log "Gitea submodule 포인터 checkout..."
git -C "${tree}" submodule update --init --recursive 2>/dev/null || \
warn "submodule update 실패 — rsync/배포 산출물로 계속"
fi
local commit
commit="$(git --git-dir="${GIT_DIR}" rev-parse --short HEAD)"
log "✅ 소스 동기화: ${commit} (${branch})"
log "✅ 소스 동기화(Gitea): ${commit} (${branch})"
elif [[ -d "${ROOT_DIR}/.git" ]]; then
log "git pull origin ${branch}..."
log "git pull origin ${branch} (Gitea/monorepo)..."
(
cd "${ROOT_DIR}"
git fetch origin "${branch}"
git checkout "${branch}"
git pull --ff-only origin "${branch}"
)
sync_github_submodules "${ROOT_DIR}" || true
log "✅ git pull 완료: $(git -C "${ROOT_DIR}" rev-parse --short HEAD)"
tree="${ROOT_DIR}"
else