diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 6a19296..c70f3bb 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -67,8 +67,11 @@ if [[ ! -d dist ]] || [[ -z "$(ls -A dist 2>/dev/null || true)" ]]; then exit 1 fi +# 清理本地 dist 里的 macOS 垃圾,避免打进包 +find dist \( -name '.DS_Store' -o -name '._*' -o -name '.AppleDouble' \) -delete 2>/dev/null || true + echo "==> 同步 dist/ -> ${DEPLOY_HOST}:${DEPLOY_PATH}" -# 排除 macOS 垃圾文件;GNU tar 会忽略 Apple xattr 告警 +# COPYFILE_DISABLE 避免 macOS 再生成 AppleDouble;远端 xattr 告警可忽略 COPYFILE_DISABLE=1 tar -C dist -czf - \ --exclude='.DS_Store' \ --exclude='._*' \ @@ -76,6 +79,7 @@ COPYFILE_DISABLE=1 tar -C dist -czf - \ . \ | ssh -o BatchMode=yes "$DEPLOY_HOST" \ "mkdir -p '$DEPLOY_PATH' && rm -rf '$DEPLOY_PATH'/* && tar -C '$DEPLOY_PATH' -xzf -" + echo "==> 校验远端文件" ssh -o BatchMode=yes "$DEPLOY_HOST" \ "test -f '$DEPLOY_PATH/index.html' && ls -lah '$DEPLOY_PATH' | head -20"