# This workflow pushes builds to the private github nuget repo on a push or merge.

name: NuGet Update

on:
  release:
    types: [published]
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    name: Update NuGet Package
    steps:
    
    - name: Checkout Repository
      uses: actions/checkout@v2
      
    - name: Setup .NET Core SDK
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '7.0.x'
        
    - name: Pack app
      run: dotnet pack NosSmooth.sln --configuration Release
      
    - name: Publish NuGet
      working-directory: nuget
      run: dotnet nuget push *.nupkg --skip-duplicate -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
      env:
        NUGET_AUTH_TOKEN: ${{secrets.NUGET_KEY}}
