Skip to content

chore: Updated System.Text.Json and MessagePack dependencies #237

chore: Updated System.Text.Json and MessagePack dependencies

chore: Updated System.Text.Json and MessagePack dependencies #237

Workflow file for this run

name: .NET
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
NuGetDirectory: ${{ github.workspace}}/nuget
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build KnightBus.sln --no-restore --configuration Release
- name: Pack
run: dotnet pack --no-build --configuration Release --output ${{ env.NuGetDirectory }}
# Install docker test dependencies
- name: Docker Azurite
run: docker run -d -p 10000:10000 -p 10001:10001 mcr.microsoft.com/azure-storage/azurite
- name: Docker nats
run: docker run -d -p 4222:4222 nats:latest
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal --logger "trx;LogFileName=test-results.trx" || true
- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: DotNET Tests
path: "**/test-results.trx"
reporter: dotnet-trx
fail-on-error: true
# Publish the NuGet package as an artifact, so they can be used in the following jobs
- uses: actions/upload-artifact@v3
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NuGetDirectory }}/*.nupkg
Publish:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [ build ]
steps:
# Download the NuGet package created in the previous job
- uses: actions/download-artifact@v3
with:
name: nuget
path: ${{ env.NuGetDirectory }}
# Install the .NET SDK indicated in the global.json file
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
# Publish all NuGet packages to NuGet.org
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
# If you retry a failed workflow, already published packages will be skipped without error.
- name: Publish NuGet package
run: |
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}
shell: pwsh