@@ -20,26 +20,21 @@ name: Release Publishing
2020on :
2121 schedule :
2222 - cron : ' 0 7 * * *'
23-
2423 workflow_dispatch :
2524 inputs :
2625 version_suffix_override :
2726 description : Version suffix override
2827 type : string
29-
3028 release :
3129 types : [published]
3230
3331jobs :
3432 build-package :
3533 runs-on : windows-latest
36-
3734 env :
3835 version_suffix_args : ${{ github.event_name != 'release' && format('--version-suffix "{0}"', inputs.version_suffix_override || format('ci.{0}', github.run_number)) || '' }}
39-
4036 permissions :
4137 contents : read
42-
4338 steps :
4439 - uses : actions/checkout@v4
4540
@@ -63,15 +58,11 @@ jobs:
6358 name : build-artifacts
6459 path : ${{ github.workspace }}/artifacts
6560
66- publish-package :
61+ publish-github- package :
6762 needs : build-package
68-
6963 runs-on : ubuntu-latest
70-
7164 permissions :
72- contents : read
7365 packages : write
74-
7566 steps :
7667 - uses : actions/checkout@v4
7768
8374 - name : Download build artifacts
8475 uses : actions/download-artifact@v4
8576
86- - name : Upload release asset
87- if : github.event_name == 'release'
88- run : gh release upload ${{ github.event.release.tag_name }}
89- ${{ github.workspace }}/build-artifacts/packages/*.*nupkg
90- env :
91- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
92-
9377 - name : Authenticate to GitHub registry
9478 run : dotnet nuget add source
9579 " https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
@@ -105,9 +89,47 @@ jobs:
10589 --api-key ${{ secrets.GITHUB_TOKEN }}
10690 --skip-duplicate
10791
92+ publish-release-package :
93+ if : github.event_name == 'release'
94+ needs : build-package
95+ runs-on : ubuntu-latest
96+ permissions :
97+ contents : write
98+ packages : write
99+ steps :
100+ - uses : actions/checkout@v4
101+
102+ - name : Setup .NET
103+ uses : actions/setup-dotnet@v2
104+ with :
105+ dotnet-version : 9.0.x
106+
107+ - name : Download build artifacts
108+ uses : actions/download-artifact@v4
109+
110+ - name : Upload release asset
111+ run : gh release upload ${{ github.event.release.tag_name }}
112+ ${{ github.workspace }}/build-artifacts/packages/*.*nupkg
113+ env :
114+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
115+
116+ publish-nuget-package :
117+ # Only publish to NuGet.org from the modelcontextprotocol/csharp-sdk repository
118+ if : ${{ github.event_name == 'release' && github.repository == 'modelcontextprotocol/csharp-sdk' }}
119+ needs : build-package
120+ runs-on : ubuntu-latest
121+ steps :
122+ - uses : actions/checkout@v4
123+
124+ - name : Setup .NET
125+ uses : actions/setup-dotnet@v2
126+ with :
127+ dotnet-version : 9.0.x
128+
129+ - name : Download build artifacts
130+ uses : actions/download-artifact@v4
131+
108132 - name : Publish to NuGet.org (Releases only)
109- # Only publish to NuGet.org from the modelcontextprotocol/csharp-sdk repository
110- if : ${{ github.event_name == 'release' && github.repository == 'modelcontextprotocol/csharp-sdk' }}
111133 run : dotnet nuget push
112134 ${{github.workspace}}/build-artifacts/packages/*.nupkg
113135 --source https://api.nuget.org/v3/index.json
0 commit comments