Skip to content

Commit 8f17644

Browse files
authored
[skip-ci] Update release.yml to support trusted publishing
1 parent d7224d3 commit 8f17644

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ jobs:
88
release:
99
if: "contains(toJSON(github.event.commits.*.message), '[Release]')"
1010
runs-on: ubuntu-latest
11-
11+
permissions:
12+
id-token: write # enable GitHub OIDC token issuance for this job
13+
1214
steps:
1315
- uses: actions/checkout@v5
1416
- name: Setup .NET
@@ -21,13 +23,19 @@ jobs:
2123
run: dotnet build -c Release --no-restore
2224
- name: Pack TwitchLib.Client
2325
run: dotnet pack -v normal -c Release --no-build
26+
# Get a short-lived NuGet API key
27+
- name: NuGet login (OIDC → temp API key)
28+
uses: NuGet/login@v1
29+
id: login
30+
with:
31+
user: ${{ secrets.NUGET_USER }}
2432
- name: Push to Nuget
25-
run: dotnet nuget push "./artifacts/package/release/*.nupkg" -k ${{ secrets.API_NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json
33+
run: dotnet nuget push "./artifacts/package/release/*.nupkg" --api-key ${{steps.login.outputs.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
2634
- name: Send Discord Notification
2735
uses: sarisia/actions-status-discord@v1
2836
if: always()
2937
with:
3038
webhook: ${{ secrets.DISCORD_WEBHOOK }}
3139
title: "Release Nuget Package"
3240
username: "TwitchLib Deploy"
33-
41+

0 commit comments

Comments
 (0)