55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
name: Deploy Development ASP.NET Core App to IIS
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- Main
|
|
|
|
env:
|
|
DOTNET_ENVIRONMENT: Development
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET SDK
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '10.0.x'
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore ServiceHost/ServiceHost.csproj
|
|
- name: Build
|
|
run: dotnet build ServiceHost/ServiceHost.csproj --configuration Release
|
|
|
|
- name: Publish
|
|
run: dotnet publish ServiceHost/ServiceHost.csproj --configuration Release --output ./publish /p:EnvironmentName=Development --no-build
|
|
|
|
- name: Deploy to IIS via Web Deploy
|
|
shell: powershell
|
|
run: |
|
|
$publishFolder = Resolve-Path ./publish
|
|
$server = $env:SERVER_HOST
|
|
$user = $env:DEPLOY_USER
|
|
$pass = $env:DEPLOY_PASSWORD
|
|
|
|
& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
|
|
-verb:sync `
|
|
-source:contentPath="$publishFolder" `
|
|
-dest:contentPath="dadmehrg",computerName="https://${server}:8172/msdeploy.axd?site=dadmehrg",userName="$user",password="$pass",authType="Basic" `
|
|
-allowUntrusted `
|
|
-enableRule:AppOffline
|
|
-disableRule:DeleteRule `
|
|
-useChecksum `
|
|
-retryAttempts:3 `
|
|
-retryInterval:2000
|
|
|
|
env:
|
|
SERVER_HOST: ${{ secrets.DEV_HOST }}
|
|
DEPLOY_USER: ${{ secrets.DEV_USER }}
|
|
DEPLOY_PASSWORD: ${{ secrets.DEV_PASS }}
|