name: Draft Release

permissions:
  contents: write

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

    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v5
      with:
        fetch-depth: 0

    - name: Setup dotnet
      uses: actions/setup-dotnet@v5
      with:
        dotnet-version: |
          8.0.x
          9.0.x

    - name: dotnet restore
      run: dotnet restore --verbosity minimal --configfile nuget.config

    - name: dotnet test
      run: dotnet test

    - uses: dotnet/nbgv@master
      with:
        setAllVars: true

    - name: create release
      shell: pwsh
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        gh release create -d --generate-notes v$env:NBGV_NuGetPackageVersion
