Publish to NuGet #2
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: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| 10.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build the project (all frameworks) | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Build netstandard2.0 | |
| run: dotnet build Spice/Spice.csproj --framework netstandard2.0 --configuration Release --no-restore | |
| - name: Build net8.0 | |
| run: dotnet build Spice/Spice.csproj --framework net8.0 --configuration Release --no-restore | |
| - name: Build net9.0 | |
| run: dotnet build Spice/Spice.csproj --framework net9.0 --configuration Release --no-restore | |
| - name: Build net10.0 | |
| run: dotnet build Spice/Spice.csproj --framework net10.0 --configuration Release --no-restore | |
| - name: Pack the project (includes all frameworks) | |
| run: dotnet pack Spice/Spice.csproj --configuration Release --no-build --output ./artifacts | |
| - name: Publish to NuGet | |
| run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |