chore: 强制提交dist命令
This commit is contained in:
@@ -114,22 +114,26 @@ git push origin master
|
||||
|
||||
### 1. 构建产物必须提交到 Git
|
||||
|
||||
**必须确保** `apps/web-antd/dist` 目录被 Git 跟踪,否则 CI/CD 无法检测到变化。
|
||||
**重要**:`apps/web-antd/dist` 目录在 `.gitignore` 中被忽略,但我们需要将其提交到 Git 才能触发 CI/CD。
|
||||
|
||||
**脚本会自动处理**:
|
||||
- 构建脚本(`build-and-push.sh` 和 `build-and-push.ps1`)会自动使用 `git add -f` 强制添加 dist 目录
|
||||
- 你不需要手动修改 `.gitignore` 文件
|
||||
|
||||
**手动添加方法**(如果使用脚本):
|
||||
```bash
|
||||
# 强制添加被忽略的 dist 目录
|
||||
git add -f apps/web-antd/dist
|
||||
```
|
||||
|
||||
**检查方法**:
|
||||
```bash
|
||||
# 检查 dist 是否被 Git 跟踪
|
||||
git ls-files apps/web-antd/dist
|
||||
|
||||
# 如果输出为空,说明 dist 未被跟踪
|
||||
# 如果输出为空,说明 dist 未被跟踪,需要使用 -f 强制添加
|
||||
```
|
||||
|
||||
**解决方法**:
|
||||
- 如果 `dist` 在 `.gitignore` 中,需要临时移除或使用强制添加:
|
||||
```bash
|
||||
git add -f apps/web-antd/dist
|
||||
```
|
||||
|
||||
### 2. 修改源码后必须重新构建
|
||||
|
||||
**重要**:修改源码后,CI/CD **不会自动触发**,需要:
|
||||
|
||||
@@ -28,7 +28,14 @@ Write-Host "🔨 Building project..." -ForegroundColor Yellow
|
||||
pnpm build:antd
|
||||
|
||||
# 5. 检查构建结果
|
||||
if (-not (Test-Path "apps\web-antd\dist") -or ((Get-ChildItem "apps\web-antd\dist" -ErrorAction SilentlyContinue).Count -eq 0)) {
|
||||
$distPath = "apps\web-antd\dist"
|
||||
if (-not (Test-Path $distPath)) {
|
||||
Write-Host "❌ Error: Build failed, dist directory not found" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
$distItems = Get-ChildItem $distPath -ErrorAction SilentlyContinue
|
||||
if ($null -eq $distItems -or $distItems.Count -eq 0) {
|
||||
Write-Host "❌ Error: Build failed, dist directory is empty" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
@@ -46,7 +53,8 @@ if ($response -eq "y" -or $response -eq "Y") {
|
||||
$gitStatus = git status --porcelain
|
||||
if ($gitStatus) {
|
||||
Write-Host "📝 Staging build artifacts..." -ForegroundColor Yellow
|
||||
git add apps/web-antd/dist
|
||||
# 使用 -f 强制添加被 .gitignore 忽略的 dist 目录
|
||||
git add -f apps/web-antd/dist
|
||||
git add -A # 添加其他更改
|
||||
|
||||
Write-Host "💾 Committing changes..." -ForegroundColor Yellow
|
||||
|
||||
@@ -46,7 +46,8 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
# 检查是否有未提交的更改
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "📝 Staging build artifacts..."
|
||||
git add apps/web-antd/dist
|
||||
# 使用 -f 强制添加被 .gitignore 忽略的 dist 目录
|
||||
git add -f apps/web-antd/dist
|
||||
git add -A # 添加其他更改
|
||||
|
||||
echo "💾 Committing changes..."
|
||||
|
||||
Reference in New Issue
Block a user