Delete .github/workflows/dad-mehrPublish.yaml
This commit is contained in:
67
.github/workflows/dad-mehrPublish.yaml
vendored
67
.github/workflows/dad-mehrPublish.yaml
vendored
@@ -1,67 +0,0 @@
|
||||
name: Build & Deploy .NET App to IIS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- WorskhopClassifiedPlan
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
# ===================== CHECKOUT CODE =====================
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# ===================== SETUP .NET SDK =====================
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
# ===================== RESTORE DEPENDENCIES =====================
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
|
||||
# ===================== BUILD PROJECT =====================
|
||||
- name: Build Project
|
||||
run: dotnet build --configuration Release
|
||||
|
||||
# --- 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
|
||||
with:
|
||||
host: ${{ secrets.REMOTE_HOST }}
|
||||
username: ${{ secrets.REMOTE_USER }}
|
||||
password: ${{ secrets.REMOTE_PASS }}
|
||||
script: |
|
||||
$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."
|
||||
|
||||
Reference in New Issue
Block a user