Skip to content

Commit d810a11

Browse files
Migrate release workflow to NuGet trusted publishing (OIDC) (#6)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: SteveWinward <2002602+SteveWinward@users.noreply.github.com>
1 parent 42b4c81 commit d810a11

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎.github/workflows/release_build.yml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ env:
1111
# setting the dotnet version
1212
DOTNET_VERSION: '8.0.x'
1313

14+
permissions:
15+
id-token: write # Required for NuGet trusted publishing (OIDC)
16+
contents: read
17+
1418
jobs:
1519
build:
1620

@@ -38,6 +42,13 @@ jobs:
3842
- name: Unit Tests
3943
run: dotnet test --no-build --verbosity normal --configuration Release
4044

45+
# Obtain a short-lived NuGet API key via OIDC trusted publishing
46+
- name: NuGet login
47+
uses: NuGet/login@v1
48+
id: login
49+
with:
50+
user: ${{ secrets.NUGET_USER }}
51+
4152
# Publish the Nuget file to Nuget.org
4253
- name: PushNuget
43-
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
54+
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --skip-duplicate

0 commit comments

Comments
 (0)