Skip to content

Commit b3cfe5a

Browse files
authored
Automatically publish tags to NuGet with Trusted Publishing (#1715)
1 parent 821f958 commit b3cfe5a

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ jobs:
187187
name: Coverlet Results Windows .NET
188188
path: coverlet
189189

190-
Publish:
190+
Publish-GitHub-Package:
191+
name: Publish GitHub Package
191192
runs-on: ubuntu-24.04
192193
if: github.ref == 'refs/heads/develop'
193194
permissions:
@@ -214,3 +215,32 @@ jobs:
214215
dotnet nuget push "*.nupkg" \
215216
--source github \
216217
--api-key ${{ secrets.GITHUB_TOKEN }}
218+
219+
Publish-NuGet-Package:
220+
name: Publish NuGet Package
221+
runs-on: ubuntu-24.04
222+
if: startsWith(github.event.ref, 'refs/tags/20')
223+
permissions:
224+
id-token: write
225+
needs:
226+
- Windows
227+
- Linux
228+
- Windows-Integration-Tests-NetFramework
229+
- Windows-Integration-Tests-Net
230+
steps:
231+
- name: Download NuGet Package
232+
uses: actions/download-artifact@v5
233+
with:
234+
name: NuGet Package
235+
236+
- name: NuGet login (OIDC → temp API key)
237+
uses: NuGet/login@v1
238+
id: login
239+
with:
240+
user: ${{ secrets.NUGET_USER }}
241+
242+
- name: Publish to NuGet Registry
243+
run: |
244+
dotnet nuget push "*.nupkg" \
245+
--source https://api.nuget.org/v3/index.json \
246+
--api-key ${{ steps.login.outputs.NUGET_API_KEY }}

0 commit comments

Comments
 (0)