From 198ebbb3d75f72a8e10deb82ea86ff1e276a14d0 Mon Sep 17 00:00:00 2001 From: Macbook Date: Sun, 14 Jun 2026 23:49:16 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=84=EC=A0=84=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/bump-desktop-version-for-push.sh | 1 + scripts/desktop-version-scope.sh | 41 ++++++++++++++++++++++++ scripts/hooks/pre-push | 22 ++++++++++--- scripts/install-desktop-git-hooks.sh | 3 +- scripts/push-with-desktop-version.sh | 3 ++ 5 files changed, 64 insertions(+), 6 deletions(-) create mode 100755 scripts/desktop-version-scope.sh diff --git a/scripts/bump-desktop-version-for-push.sh b/scripts/bump-desktop-version-for-push.sh index 50b90b5..2687743 100755 --- a/scripts/bump-desktop-version-for-push.sh +++ b/scripts/bump-desktop-version-for-push.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash # git push 전 desktop semver patch bump → tauri.conf.json + desktop/package.json +# Desktop 번들: frontend + packages/shared, 런타임: backend API # (로컬 dist-desktop/build-info 는 무시 — stale 버전 방지) set -euo pipefail diff --git a/scripts/desktop-version-scope.sh b/scripts/desktop-version-scope.sh new file mode 100755 index 0000000..b3f261d --- /dev/null +++ b/scripts/desktop-version-scope.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Desktop 앱 번들·런타임에 영향을 주는 경로 (frontend 공유 + backend API) +# +# - desktop/ Tauri 셸 +# - frontend/ @frontend 번들 (desktop 과 동일 UI) +# - backend/ API·비즈니스 로직 (desktop 이 exdev API 사용) +# - packages/shared/ frontend·desktop 공유 모듈 +set -euo pipefail + +# grep -E extended regex (한 줄 = OR, ^ = 경로 시작) +DESKTOP_VERSION_AFFECTED_REGEX='^(desktop/|frontend/|backend/|packages/shared/|scripts/(build-desktop|jenkins-desktop|publish-desktop|bump-desktop|push-with-desktop))' + +desktop_version_diff_affects_app() { + local range="${1:-}" + [[ -n "$range" ]] || return 1 + git diff --name-only "$range" 2>/dev/null | grep -Eq "$DESKTOP_VERSION_AFFECTED_REGEX" +} + +desktop_version_list_affected_in_range() { + local range="${1:-}" + [[ -n "$range" ]] || return 0 + git diff --name-only "$range" 2>/dev/null | grep -E "$DESKTOP_VERSION_AFFECTED_REGEX" || true +} + +if [[ "${BASH_SOURCE[0]:-}" == "${0:-}" ]]; then + case "${1:-}" in + check) + desktop_version_diff_affects_app "${2:-HEAD~1..HEAD}" && exit 0 || exit 1 + ;; + list) + desktop_version_list_affected_in_range "${2:-HEAD~1..HEAD}" + ;; + regex) + echo "$DESKTOP_VERSION_AFFECTED_REGEX" + ;; + *) + echo "Usage: $0 check|list|regex [git-range]" >&2 + exit 1 + ;; + esac +fi diff --git a/scripts/hooks/pre-push b/scripts/hooks/pre-push index 324261a..f1052d1 100755 --- a/scripts/hooks/pre-push +++ b/scripts/hooks/pre-push @@ -1,11 +1,12 @@ #!/usr/bin/env bash -# Desktop/Frontend 변경 push 시 semver bump 필수 (plain git push 차단) +# frontend/backend/desktop/shared 변경 push 시 semver bump 필수 set -euo pipefail ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" cd "$ROOT" -DESKTOP_PATHS='^(desktop/|frontend/|scripts/(build-desktop|jenkins-desktop|publish-desktop|bump-desktop))' +# shellcheck disable=SC1091 +source "$ROOT/scripts/desktop-version-scope.sh" read_local_version() { "$ROOT/scripts/read-desktop-version.sh" 2>/dev/null || echo "0.0.0" @@ -36,7 +37,7 @@ while read -r _local_ref local_sha _remote_ref remote_sha; do range="${remote_sha}..${local_sha}" fi - if ! git diff --name-only "$range" 2>/dev/null | grep -Eq "$DESKTOP_PATHS"; then + if ! desktop_version_diff_affects_app "$range"; then continue fi @@ -49,10 +50,21 @@ while read -r _local_ref local_sha _remote_ref remote_sha; do echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - echo " Desktop/Frontend 변경 push — semver bump 가 필요합니다." + echo " Desktop 앱 영향 변경(frontend/backend/desktop/shared)" + echo " push — semver bump 가 필요합니다." echo " 로컬 v${local_ver} ≤ 원격 v${remote_ver}" echo "" - echo " 다음 명령으로 bump + push + Jenkins 빌드:" + affected="$(desktop_version_list_affected_in_range "$range" | head -5 | sed 's/^/ /')" + if [[ -n "$affected" ]]; then + echo " 변경 예:" + echo "$affected" + count="$(desktop_version_list_affected_in_range "$range" | wc -l | tr -d ' ')" + if [[ "$count" -gt 5 ]]; then + echo " ... 외 $((count - 5))개 파일" + fi + echo "" + fi + echo " bump + push + Jenkins Desktop 빌드:" echo " ./scripts/push-with-desktop-version.sh" echo "" echo " bump 만:" diff --git a/scripts/install-desktop-git-hooks.sh b/scripts/install-desktop-git-hooks.sh index 7c392a7..e2689e0 100755 --- a/scripts/install-desktop-git-hooks.sh +++ b/scripts/install-desktop-git-hooks.sh @@ -14,4 +14,5 @@ fi cp "$HOOK_SRC" "$GIT_HOOK" chmod +x "$GIT_HOOK" echo "[install-desktop-git-hooks] pre-push hook 설치됨" -echo " Desktop/Frontend 변경 시 ./scripts/push-with-desktop-version.sh 사용" +echo " frontend/backend/desktop/shared 변경 push 시 bump 필수" +echo " → ./scripts/push-with-desktop-version.sh" diff --git a/scripts/push-with-desktop-version.sh b/scripts/push-with-desktop-version.sh index ec21762..d75b494 100755 --- a/scripts/push-with-desktop-version.sh +++ b/scripts/push-with-desktop-version.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash # git push + desktop semver 명시 bump (커밋 포함) # +# Desktop 은 frontend 소스를 번들하고 backend API 를 사용하므로 +# frontend / backend / desktop / packages/shared 변경 후 push 시 사용하세요. +# # Usage: # ./scripts/push-with-desktop-version.sh [git push 인자...] # ./scripts/push-with-desktop-version.sh origin main