From 24401a71241a7eabf984d1586dcd6348b24b5605 Mon Sep 17 00:00:00 2001 From: come150 Date: Thu, 12 Feb 2026 11:39:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0GitHub=20Actions=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=83=A8=E7=BD=B2=E5=88=B0IIS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-to-iis.yml | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/deploy-to-iis.yml diff --git a/.github/workflows/deploy-to-iis.yml b/.github/workflows/deploy-to-iis.yml new file mode 100644 index 0000000..34b741d --- /dev/null +++ b/.github/workflows/deploy-to-iis.yml @@ -0,0 +1,58 @@ +name: Deploy .NET to IIS + +on: + workflow_dispatch: + inputs: + environment: + description: '部署环境' + required: true + type: choice + options: + - development + - staging + - production + default: 'production' + +jobs: + deploy: + runs-on: self-hosted + + steps: + - name: 显示部署信息 + run: | + Write-Host "========== 开始部署 ==========" -ForegroundColor Cyan + Write-Host "环境: ${{ github.event.inputs.environment }}" -ForegroundColor Yellow + Write-Host "时间: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" -ForegroundColor Yellow + shell: powershell + + - name: 构建.NET项目 + run: | + Write-Host "开始构建.NET项目..." -ForegroundColor Yellow + + $projectPath = "E:\github\Quant.Infra.Net\src\Quant.Infra.Net\Quant.Infra.Net.csproj" + $outputPath = "E:\github\Quant.Infra.Net\publish" + + if (Test-Path $outputPath) { + Remove-Item $outputPath -Recurse -Force + } + + dotnet publish $projectPath -c Release -o $outputPath + + Write-Host " 构建完成" -ForegroundColor Green + shell: powershell + + - name: 部署到IIS + shell: powershell + run: | + Write-Host "========== 开始部署到IIS ==========" -ForegroundColor Cyan + + $sourcePath = "E:\github\Quant.Infra.Net\publish" + $targetPath = "${{ secrets.IIS_SITE_PATH }}" + + Write-Host "源路径: $sourcePath" + Write-Host "目标路径: $targetPath" + + Write-Host "复制文件..." -ForegroundColor Yellow + Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force + + Write-Host "========== 部署完成 ==========" -ForegroundColor Green From ec7d397f6c4b3f9420bb086e2fda1368f9b061a8 Mon Sep 17 00:00:00 2001 From: come150 Date: Thu, 12 Feb 2026 12:55:45 +0800 Subject: [PATCH 2/2] test --- .github/workflows/deploy-to-iis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-to-iis.yml b/.github/workflows/deploy-to-iis.yml index 34b741d..87ee0f8 100644 --- a/.github/workflows/deploy-to-iis.yml +++ b/.github/workflows/deploy-to-iis.yml @@ -11,7 +11,7 @@ on: - development - staging - production - default: 'production' + default: 'production' jobs: deploy: