update master #245
  
    
      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 | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| BUILD_PATH: '${{github.workspace}}/artifacts' | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - dev | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - master | |
| - dev | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| services: | |
| azurite: | |
| image: mcr.microsoft.com/azure-storage/azurite | |
| ports: | |
| - 10000:10000 | |
| - 10001:10001 | |
| - 10002:10002 | |
| volumes: | |
| - azurite_data:/data mcr.microsoft.com/azure-storage/azurite | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Restore Dependencies | |
| run: dotnet restore | |
| - name: Build Project | |
| run: 'dotnet build --no-restore --configuration Release' | |
| - name: Test Project | |
| run: 'dotnet test --no-build --configuration Release' | |
| - name: Create Packages | |
| if: success() && github.event_name != 'pull_request' | |
| run: 'dotnet pack --configuration Release --no-build --output "${{env.BUILD_PATH}}"' | |
| - name: Upload Packages | |
| if: success() && github.event_name != 'pull_request' | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: packages | |
| path: '${{env.BUILD_PATH}}' | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/v')) | |
| steps: | |
| - name: Download Artifact | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: packages | |
| - name: Publish Packages GitHub | |
| run: | | |
| for package in $(find -name "*.nupkg"); do | |
| echo "${0##*/}": Pushing $package... | |
| dotnet nuget push $package --source https://nuget.pkg.github.com/serilog-contrib/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate | |
| done | |
| - name: Publish Packages Nuget | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| for package in $(find -name "*.nupkg"); do | |
| echo "${0##*/}": Pushing $package... | |
| dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate | |
| done | |