add claude prompt #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build, Test, and Deploy | |
| on: | |
| push: | |
| branches: ['**'] | |
| pull_request: | |
| branches: ['**'] | |
| jobs: | |
| build-test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET 10 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore src/MyBlog.slnx | |
| - name: Build solution | |
| run: dotnet build src/MyBlog.slnx -c Release --no-restore | |
| - name: Run tests | |
| run: dotnet test src/MyBlog.slnx -c Release --no-build --logger trx --results-directory TestResults | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.os }} | |
| path: TestResults | |
| retention-days: 7 | |
| deploy: | |
| needs: build-test | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET 10 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Publish application | |
| run: dotnet publish src/MyBlog.Web/MyBlog.Web.csproj -c Release -o ./publish -r win-x86 --self-contained false | |
| - name: Deploy via WebDeploy | |
| shell: pwsh | |
| env: | |
| DEPLOY_SOURCE: ${{ github.workspace }}\publish | |
| DEPLOY_SITE: ${{ secrets.WEBSITE_NAME }} | |
| DEPLOY_HOST: ${{ secrets.SERVER_COMPUTER_NAME }} | |
| DEPLOY_USER: ${{ secrets.SERVER_USERNAME }} | |
| DEPLOY_PASSWORD: ${{ secrets.SERVER_PASSWORD }} | |
| run: | | |
| $msdeployPath = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" | |
| if (-not (Test-Path $msdeployPath)) { | |
| Write-Host "Installing Web Deploy..." | |
| choco install webdeploy -y --no-progress | |
| } | |
| Write-Host "Deploying to $env:DEPLOY_HOST..." | |
| $sourceArg = "-source:contentPath=$env:DEPLOY_SOURCE" | |
| $destArg = "-dest:contentPath=$env:DEPLOY_SITE,computerName=https://$($env:DEPLOY_HOST):8172/msdeploy.axd,userName=$env:DEPLOY_USER,password=$env:DEPLOY_PASSWORD,authType=Basic" | |
| & $msdeployPath -verb:sync $sourceArg $destArg -allowUntrusted -enableRule:DoNotDeleteRule | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Deployment failed with exit code $LASTEXITCODE" | |
| exit 1 | |
| } | |
| Write-Host "Deployment completed successfully!" |