trigger [build] #8
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 NuGet (on [build] commit) | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| jobs: | |
| publish: | |
| if: contains(github.event.head_commit.message, '[build]') | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Restore (solution, fallback to project) | |
| shell: pwsh | |
| run: | | |
| dotnet restore ./S2PluginKit.slnx | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Host "Restore .slnx failed, restoring csproj instead" | |
| dotnet restore ./S2PluginKit.csproj | |
| } | |
| - name: Build (Release; solution, fallback to project) | |
| shell: pwsh | |
| run: | | |
| dotnet build ./S2PluginKit.slnx --configuration Release --no-restore | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Host "Build .slnx failed, building csproj instead" | |
| dotnet build ./S2PluginKit.csproj --configuration Release --no-restore | |
| } | |
| - name: Create artifacts directory | |
| shell: pwsh | |
| run: | | |
| New-Item -Path artifacts -ItemType Directory -Force | Out-Null | |
| # Packing is not required; GeneratePackageOnBuild=true emits .nupkg during build into artifacts | |
| # If you prefer explicit packing, re-enable a pack step. | |
| - name: Push package to NuGet.org | |
| run: dotnet nuget push "artifacts/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate |