Tspence/fix nuget publish (#72) #13
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: NuGet Publish | |
| on: | |
| push: | |
| branches: [ main ] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: Update NuGet package | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup .NET Core @ Latest | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| # As per https://github.com/NuGet/setup-nuget/issues/168#issuecomment-2576628231 | |
| # We are now required to install mono separately | |
| - name: Install Mono | |
| run: sudo apt install mono-devel | |
| - name: Build (Framework 2.0) | |
| run: xbuild ./src/net20/src.net20.csproj /property:Configuration=Release | |
| - name: Build (Framework 4.0) | |
| run: xbuild ./src/net40/src.net40.csproj /property:Configuration=Release | |
| - name: Build (Framework 4.5) | |
| run: xbuild ./src/net45/src.net45.csproj /property:Configuration=Release | |
| - name: Build (DotNetCore 8.0) | |
| run: dotnet build -c Release ./src/net80/src.net80.csproj | |
| - name: Build (NetStandard 2.0) | |
| run: dotnet build -c Release ./src/netstandard20/src.netstandard20.csproj | |
| - name: Setup Nuget | |
| uses: nuget/setup-nuget@v2 | |
| with: | |
| nuget-api-key: ${{ secrets.NUGET_API_KEY }} | |
| nuget-version: '5.x' | |
| - name: Run Nuget pack | |
| run: nuget pack CSVFile.nuspec | |
| - name: Push generated package to GitHub registry | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| run: nuget push *.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} |