Browse Source

chore: purge macOS junk from dist before deploy

main
xiaosi 2 weeks ago
parent
commit
2a10f422e1
  1. 6
      scripts/deploy.sh

6
scripts/deploy.sh

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

Loading…
Cancel
Save