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