test
Some checks failed
Backend_develop / build (push) Failing after 12s

This commit is contained in:
威勝 張 2025-02-24 21:07:58 +08:00
parent a88862d6b0
commit 6618b04a26

View File

@ -21,27 +21,19 @@ jobs:
$apiPath = "D:\Code\Server\TCM\API"
# 確保主資料夾存在
if (-not (Test-Path $projectPath)) {
echo "錯誤: 主資料夾 $projectPath 不存在"
exit 1
}
if (-not (Test-Path $projectPath)) {exit 1}
cd $projectPath
# 刪除原 Backend 資料夾
if (Test-Path $backendPath) {
Remove-Item -Recurse -Force $backendPath
}
if (Test-Path $backendPath) { Remove-Item -Recurse -Force $backendPath }
# 確保目標資料夾存在
New-Item -Path $backendPath -ItemType Directory -Force | Out-Null
echo " Cloning repository..."
git clone -b develop http://leovip125.ddns.net:8418/TCM/Backend.git $backendPath
if ($LASTEXITCODE -ne 0) {
echo "錯誤: Git Clone 失敗"
exit 1
}
if ($LASTEXITCODE -ne 0) { exit 1}
echo "Clone End"
# .NET 發布
@ -49,38 +41,24 @@ jobs:
# 切換到 Backend 目錄
cd $backendPath
if ($LASTEXITCODE -ne 0) {
echo "錯誤: 無法切換到 Backend 目錄"
exit 1
}
if ($LASTEXITCODE -ne 0) { exit 1}
# 還原與建置
dotnet restore
if ($LASTEXITCODE -ne 0) {
echo "錯誤: dotnet restore 失敗"
exit 1
}
if ($LASTEXITCODE -ne 0) {exit 1 }
dotnet build --configuration Release
if ($LASTEXITCODE -ne 0) {
echo "錯誤: dotnet build 失敗"
exit 1
}
if ($LASTEXITCODE -ne 0) { exit 1}
# 移除舊的 API 發布資料夾
if (Test-Path $apiPath) {
Remove-Item -Recurse -Force $apiPath
}
if (Test-Path $apiPath) { Remove-Item -Recurse -Force $apiPath }
# 確保目標資料夾存在
New-Item -Path $apiPath -ItemType Directory -Force | Out-Null
# 發布
dotnet publish -c Release -o $apiPath
if ($LASTEXITCODE -ne 0) {
echo "錯誤: dotnet publish 失敗"
exit 1
}
if ($LASTEXITCODE -ne 0) {exit 1 }
echo "發布 end"