From e52ffe737511b21ec2d37347affd1f2cf17d195f Mon Sep 17 00:00:00 2001 From: lzh Date: Tue, 23 Dec 2025 14:13:20 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=96=B0=E7=89=88=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy/build-and-push.ps1 | 10 ++++++---- scripts/deploy/build-and-push.sh | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/deploy/build-and-push.ps1 b/scripts/deploy/build-and-push.ps1 index c9d6f177d..d21e014b4 100644 --- a/scripts/deploy/build-and-push.ps1 +++ b/scripts/deploy/build-and-push.ps1 @@ -49,11 +49,12 @@ Write-Host "Build size: $buildSizeRounded MB" -ForegroundColor Cyan $response = Read-Host "Do you want to commit and push to repository? (y/n)" if ($response -eq "y" -or $response -eq "Y") { - $gitStatus = git status --porcelain - if ($gitStatus) { + # 只检查 dist 目录的变化,不检查其他文件 + $distStatus = git status --porcelain apps/web-antd/dist + if ($distStatus) { Write-Host "Staging build artifacts..." -ForegroundColor Yellow + # 只添加 dist 目录,不添加其他文件 git add -f apps/web-antd/dist - git add -A Write-Host "Committing changes..." -ForegroundColor Yellow # 使用 --no-verify 跳过 pre-commit hooks,避免检查大量构建产物文件 @@ -66,7 +67,8 @@ if ($response -eq "y" -or $response -eq "Y") { Write-Host "Build artifacts pushed successfully!" -ForegroundColor Green Write-Host "Waiting for CI/CD to deploy..." -ForegroundColor Cyan } else { - Write-Host "No changes to commit" -ForegroundColor Yellow + Write-Host "No changes in dist directory to commit" -ForegroundColor Yellow + Write-Host "Note: Only dist directory changes will be committed, other files are ignored" -ForegroundColor Cyan } } else { Write-Host "Skipping git push. You can manually commit and push later." -ForegroundColor Yellow diff --git a/scripts/deploy/build-and-push.sh b/scripts/deploy/build-and-push.sh index cf88fc6ff..89f60f751 100644 --- a/scripts/deploy/build-and-push.sh +++ b/scripts/deploy/build-and-push.sh @@ -45,12 +45,13 @@ echo "📊 Build size: $BUILD_SIZE" read -p "Do you want to commit and push to repository? (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then - # 检查是否有未提交的更改 - if [ -n "$(git status --porcelain)" ]; then + # 只检查 dist 目录的变化,不检查其他文件 + DIST_STATUS=$(git status --porcelain apps/web-antd/dist) + if [ -n "$DIST_STATUS" ]; then echo "📝 Staging build artifacts..." + # 只添加 dist 目录,不添加其他文件 # 使用 -f 强制添加被 .gitignore 忽略的 dist 目录 git add -f apps/web-antd/dist - git add -A # 添加其他更改 echo "💾 Committing changes..." # 使用 --no-verify 跳过 pre-commit hooks,避免检查大量构建产物文件 @@ -63,7 +64,8 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then echo "✅ Build artifacts pushed successfully!" echo "⏳ Waiting for CI/CD to deploy..." else - echo "ℹ️ No changes to commit" + echo "ℹ️ No changes in dist directory to commit" + echo "Note: Only dist directory changes will be committed, other files are ignored" fi else echo "ℹ️ Skipping git push. You can manually commit and push later."