Fix gha nuget action. #3
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: Publish to NuGet | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Triggers only on tags starting with "v" | |
| jobs: | |
| build-and-publish: | |
| runs-on: windows-latest # ← must run on Windows for net*-windows projects | |
| strategy: | |
| matrix: | |
| framework: ['net8.0-windows10.0.17763.0'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore src/SIPSorceryMedia.Windows.csproj | |
| - name: Build | |
| run: dotnet build src/SIPSorceryMedia.Windows.csproj -c Release --no-restore | |
| - name: Pack NuGet package | |
| run: dotnet pack src/SIPSorceryMedia.Windows.csproj -c Release -o ./artifacts --no-build | |
| - name: Publish to NuGet.org | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| run: dotnet nuget push .\artifacts\*.nupkg --source https://api.nuget.org/v3/index.json --api-key $env:NUGET_API_KEY | |