From 6fd653b45dae9af86d4472a11e2d47eef773cb74 Mon Sep 17 00:00:00 2001 From: SocksOnHead Date: Sun, 20 Jul 2025 14:42:29 +0200 Subject: [PATCH] Add restart --- .github/workflows/build.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6335167..f1d8996 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,6 +79,7 @@ jobs: deploy: runs-on: self-hosted # Ensure your self-hosted runner is configured needs: build + environment: 'prod' steps: - name: Download .NET Artifacts @@ -94,3 +95,19 @@ jobs: - name: Copy .NET Publish Files to IIS Server run: | xcopy ".\output\dotnet\*" "C:\inetpub\applications\HomeApi" /s /i /y + + - name: Restart IIS Application Pool + run: | + Import-Module WebAdministration + $appPoolName = "${{ vars.IIS_APP_POOL_NAME }}" -or "HomeApi" + Write-Host "Restarting application pool: $appPoolName" + + # Check if app pool exists + if (Test-Path "IIS:\AppPools\$appPoolName") { + Restart-WebAppPool -Name $appPoolName + Write-Host "Application pool restarted successfully" + } else { + Write-Host "Warning: Application pool '$appPoolName' not found. Using IISReset instead." + iisreset /restart + Write-Host "IIS restarted successfully" + }