This commit is contained in:
syntax24
2025-11-05 13:27:46 +03:30

View File

@@ -24,18 +24,24 @@ jobs:
- name: Restore dependencies
run: dotnet restore
# ===================== BUILD PROJECT =====================
- name: Build Project
run: dotnet build --configuration Release
# ===================== PUBLISH PROJECT =====================
# --- 4. Build-
- name: Build
run: dotnet build --configuration Release
# ===================== PUBLISH PROJECT =====================
- name: Publish Project
shell: powershell
run: |
$publishFolder = Join-Path $env:GITHUB_WORKSPACE "publish"
Write-Host "Publishing to folder: $publishFolder"
dotnet publish --configuration Release --output "$publishFolder" --no-build /p:EnvironmentName=Production
# ===================== DEPLOY TO IIS SERVER =====================
- name: Deploy to IIS via SSH
uses: appleboy/ssh-action@v1.0.0
@@ -47,15 +53,15 @@ jobs:
$siteName = "dad-mehr"
$source = "D:\a\${{ github.event.repository.name }}\${{ github.event.repository.name }}\publish"
$destination = "C:\inetpub\wwwroot\dad-mehr"
Write-Host "Stopping IIS site $siteName ..."
& "C:\Windows\System32\inetsrv\appcmd.exe" stop site $siteName | Out-Null
Write-Host "Copying files from $source to $destination ..."
robocopy $source $destination /E /XO /R:2 /W:3 /NFL /NDL /NP
Write-Host "Starting IIS site $siteName ..."
& "C:\Windows\System32\inetsrv\appcmd.exe" start site $siteName | Out-Null
Write-Host "✅ Deployment completed successfully."