parent
1a71ef9f24
commit
272a3328be
@ -22,13 +22,45 @@ jobs:
|
||||
echo "Clone End"
|
||||
# NET 發布
|
||||
echo "發布 start"
|
||||
cd Backend
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd D:\Code\Server\TCM
|
||||
if (Test-Path "API") { Remove-Item -Recurse -Force "API" } # 刪除原資料
|
||||
if (-not (Test-Path "API")) {New-Item -Path "API" -ItemType Directory -Force} # 建立資料夾
|
||||
cd D:\Code\Project\TCM\Backend
|
||||
dotnet publish -c Release -o D:\Code\Server\TCM\API
|
||||
echo "發布 end"
|
||||
|
||||
# 切換到 Backend 目錄並確保存在
|
||||
$backendPath = "D:\Code\Project\TCM\Backend"
|
||||
if (Test-Path $backendPath) {
|
||||
cd $backendPath
|
||||
} else {
|
||||
echo "錯誤: Backend 目錄不存在"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 還原與建置
|
||||
dotnet restore
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
echo "錯誤: dotnet restore 失敗"
|
||||
exit 1
|
||||
}
|
||||
|
||||
dotnet build --configuration Release
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
echo "錯誤: dotnet build 失敗"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 移除舊的 API 發布資料夾
|
||||
$apiPath = "D:\Code\Server\TCM\API"
|
||||
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
|
||||
}
|
||||
|
||||
echo "發布 end"
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user