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