Add files via upload #30
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: .NET Build, Test & Coverage | |
| on: | |
| push: | |
| branches: [ master ] | |
| tags: | |
| - 'v*' # run on version tags like v0.1.0 | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore | |
| run: dotnet restore ./src/ByteFlow/ByteFlow.sln | |
| - name: Build | |
| run: dotnet build ./src/ByteFlow/ByteFlow.sln --no-restore --configuration Release | |
| - name: Test with coverage | |
| run: dotnet test ./src/ByteFlow/ByteFlow.sln --no-build --configuration Release --collect:"XPlat Code Coverage" | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./tests/ByteFlow.Tests/TestResults/**/*.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') # only run on tags starting with v | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Pack | |
| run: dotnet pack ./src/ByteFlow/ByteFlow/ByteFlow.csproj -c Release -o ./nupkgs | |
| - name: Publish to NuGet | |
| run: dotnet nuget push "./nupkgs/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |