Updated the .NET GitHub Actions workflow to specify project files for restore, build, and publish steps. Replaced hardcoded credentials with GitHub secrets for deployment.
42 lines
1.2 KiB
YAML
42 lines
1.2 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: '8.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
|
|
& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
|
|
-verb:sync `
|
|
-source:contentPath="$publishFolder" `
|
|
-dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="${{ secrets.DEPLOY_USER }}",password="${{ secrets.DEPLOY_PASSWORD }}",authType="Basic" `
|
|
-allowUntrusted `
|
|
-enableRule:AppOffline
|