From 7eba632f1c057407c7da73332668d16bce32060b Mon Sep 17 00:00:00 2001 From: Mahan Chamani <109232147+mahanch@users.noreply.github.com> Date: Sat, 22 Nov 2025 13:31:47 +0330 Subject: [PATCH] Refactor .NET workflow to use project-specific commands Updated the .NET GitHub Actions workflow to specify project files for restore, build, and publish steps. Replaced hardcoded credentials with GitHub secrets for deployment. --- .github/workflows/dotnet-developPublish.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dotnet-developPublish.yml b/.github/workflows/dotnet-developPublish.yml index aace164d..ddb25830 100644 --- a/.github/workflows/dotnet-developPublish.yml +++ b/.github/workflows/dotnet-developPublish.yml @@ -19,16 +19,15 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0.x' # یا نسخه پروژه‌ت + dotnet-version: '8.0.x' - name: Restore dependencies - run: dotnet restore - + run: dotnet restore ServiceHost/ServiceHost.csproj - name: Build - run: dotnet build --configuration Release + run: dotnet build ServiceHost/ServiceHost.csproj --configuration Release - name: Publish - run: dotnet publish --configuration Release --output ./publish /p:EnvironmentName=Development --no-build + run: dotnet publish ServiceHost/ServiceHost.csproj --configuration Release --output ./publish /p:EnvironmentName=Development --no-build - name: Deploy to IIS via Web Deploy shell: powershell @@ -37,12 +36,6 @@ jobs: & "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="Administrator",password="R2rNpdnetP3j>q5b18",authType="Basic" ` + -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 - - - env: - SERVER_HOST: your-server-ip-or-domain - DEPLOY_USER: ${{ secrets.DEPLOY_USER }} - DEPLOY_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }}