diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..b075688 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,44 @@ +name: .NET + +on: + push: + branches: + - master + - develop + pull_request: + branches: + - master + - develop + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + dotnet-version: ["6.0.x", "7.0.x", "8.0.x"] + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET ${{ matrix.dotnet-version }} + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ matrix.dotnet-version }} + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Test + run: dotnet test --no-build --verbosity normal + + - name: Pack + run: dotnet pack --no-build -o ./nupkg + + - name: Push NuGet package to GitHub + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + run: dotnet nuget push ./nupkg/*.nupkg --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key $GITHUB_TOKEN