name: Nuget

on:
  push:
    branches: [ master ]
    
jobs:
  build:

    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v1
      with:
        fetch-depth: 0
    - name: Setup dotnet SDK 3.1
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '3.1.x'
    - name: Setup dotnet SDK 5
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '5.0.x'          
    - name: Test
      run: dotnet test
    - name: Pack
      run: dotnet pack --configuration Release src/KubernetesClient -o pkg
    - name: Push
      run: dotnet nuget push pkg\*.nupkg -s https://www.nuget.org/ -k ${{ secrets.nuget_api_key }}
