Skip to content

Commit c052d94

Browse files
authored
Refactor NuGet API key handling in workflow
Updated NuGet login step to use OIDC for temporary API key.
1 parent 02f12c8 commit c052d94

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/publish-clients.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Publish Client Libraries
22

33
# Triggered on release creation. Also supports manual dispatch for testing.
4-
# Secrets required:
5-
# NUGET_API_KEY - NuGet.org API key for dotnet nuget push
4+
#
5+
# nuget uses OIDC Trusted Publishing: https://www.nuget.org/account/trustedpublishing
66
#
77
# npm publishing uses OIDC Trusted Publishing — no NPM_TOKEN required.
88
# Configure the trusted publisher at: npmjs.com → Package → Settings → Trusted Publisher
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
permissions:
2929
contents: read
30-
id-token: write # required for npm provenance attestation
30+
id-token: write # required for nuget/npm provenance attestation
3131

3232
steps:
3333
- name: Checkout
@@ -70,10 +70,17 @@ jobs:
7070
/p:Version=${{ steps.version.outputs.version }}
7171
--output clients/csharp/bin/Release
7272
73+
# Get a short-lived NuGet API key
74+
- name: NuGet login (OIDC → temp API key)
75+
uses: NuGet/login@v1
76+
id: login
77+
with:
78+
user: Universalis
79+
7380
- name: Push to NuGet.org
7481
run: >
7582
dotnet nuget push clients/csharp/bin/Release/*.nupkg
76-
--api-key ${{ secrets.NUGET_API_KEY }}
83+
--api-key ${{ steps.login.outputs.NUGET_API_KEY }}
7784
--source https://api.nuget.org/v3/index.json
7885
--skip-duplicate
7986

0 commit comments

Comments
 (0)