Skip to content

Commit b2fa052

Browse files
committed
update workflow v2 [build]
1 parent 8cf635e commit b2fa052

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

.github/workflows/nuget-publish.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: windows-latest
1212
permissions:
1313
contents: read
14+
1415
steps:
1516
- name: Checkout
1617
uses: actions/checkout@v4
@@ -20,31 +21,28 @@ jobs:
2021
with:
2122
dotnet-version: "10.0.x"
2223

23-
- name: Restore (solution, fallback to project)
24+
- name: Restore
2425
shell: pwsh
2526
run: |
26-
dotnet restore ./S2PluginKit.slnx
27-
if ($LASTEXITCODE -ne 0) {
28-
Write-Host "Restore .slnx failed, restoring csproj instead"
29-
dotnet restore ./S2PluginKit.csproj
30-
}
27+
dotnet restore ./S2PluginKit.slnx || dotnet restore ./S2PluginKit.csproj
3128
32-
- name: Build (Release; solution, fallback to project)
29+
- name: Build (Release)
3330
shell: pwsh
3431
run: |
35-
dotnet build ./S2PluginKit.slnx --configuration Release --no-restore
36-
if ($LASTEXITCODE -ne 0) {
37-
Write-Host "Build .slnx failed, building csproj instead"
38-
dotnet build ./S2PluginKit.csproj --configuration Release --no-restore
39-
}
32+
dotnet build ./S2PluginKit.slnx -c Release --no-restore || `
33+
dotnet build ./S2PluginKit.csproj -c Release --no-restore
4034
41-
- name: Create artifacts directory
35+
- name: Pack NuGet (Release)
4236
shell: pwsh
4337
run: |
44-
New-Item -Path artifacts -ItemType Directory -Force | Out-Null
45-
46-
# Packing is not required; GeneratePackageOnBuild=true emits .nupkg during build into artifacts
47-
# If you prefer explicit packing, re-enable a pack step.
38+
dotnet pack ./S2PluginKit.csproj `
39+
-c Release `
40+
-o artifacts `
41+
--no-build
4842
4943
- name: Push package to NuGet.org
50-
run: dotnet nuget push "artifacts/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
44+
run: |
45+
dotnet nuget push "artifacts/*.nupkg" `
46+
--source https://api.nuget.org/v3/index.json `
47+
--api-key ${{ secrets.NUGET_API_KEY }} `
48+
--skip-duplicate

0 commit comments

Comments
 (0)