버전업데이트 수정
This commit is contained in:
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
# Desktop/Frontend 변경 push 시 semver bump 필수 (plain git push 차단)
|
||||
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))'
|
||||
|
||||
read_local_version() {
|
||||
"$ROOT/scripts/read-desktop-version.sh" 2>/dev/null || echo "0.0.0"
|
||||
}
|
||||
|
||||
read_remote_version() {
|
||||
local remote_ref="$1"
|
||||
git show "${remote_ref}:desktop/src-tauri/tauri.conf.json" 2>/dev/null \
|
||||
| node -e "let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{console.log(JSON.parse(d).version||'0.0.0')}catch{console.log('0.0.0')}})" \
|
||||
|| echo "0.0.0"
|
||||
}
|
||||
|
||||
version_gt() {
|
||||
node -e "
|
||||
const parse = v => String(v||'0').replace(/^v/i,'').split('.').map(n=>parseInt(n,10)||0);
|
||||
const a=parse(process.argv[1]), b=parse(process.argv[2]);
|
||||
for(let i=0;i<3;i++){const d=(a[i]||0)-(b[i]||0);if(d){process.exit(d>0?0:1)}}
|
||||
process.exit(0);
|
||||
" "$1" "$2"
|
||||
}
|
||||
|
||||
while read -r _local_ref local_sha _remote_ref remote_sha; do
|
||||
[[ "$local_sha" == "0000000000000000000000000000000000000000" ]] && continue
|
||||
|
||||
if [[ "$remote_sha" == "0000000000000000000000000000000000000000" ]]; then
|
||||
range="$local_sha"
|
||||
else
|
||||
range="${remote_sha}..${local_sha}"
|
||||
fi
|
||||
|
||||
if ! git diff --name-only "$range" 2>/dev/null | grep -Eq "$DESKTOP_PATHS"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
local_ver="$(read_local_version)"
|
||||
remote_ver="$(read_remote_version "$remote_sha")"
|
||||
|
||||
if version_gt "$local_ver" "$remote_ver"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo " Desktop/Frontend 변경 push — semver bump 가 필요합니다."
|
||||
echo " 로컬 v${local_ver} ≤ 원격 v${remote_ver}"
|
||||
echo ""
|
||||
echo " 다음 명령으로 bump + push + Jenkins 빌드:"
|
||||
echo " ./scripts/push-with-desktop-version.sh"
|
||||
echo ""
|
||||
echo " bump 만:"
|
||||
echo " ./scripts/bump-desktop-version-for-push.sh"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
exit 1
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user