Skip to content

Commit d5cc9cc

Browse files
authored
[skip-ci] Update release.yml to support trusted publishing
1 parent 4c8405b commit d5cc9cc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 2 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,5 +23,11 @@ jobs:
2123
run: dotnet build -c Release --no-restore
2224
- name: Pack TwitchLib.EventSub.Webhooks
2325
run: dotnet pack ./TwitchLib.EventSub.Webhooks/TwitchLib.EventSub.Webhooks.csproj -v normal -c Release -o nugets --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 "./nugets/*.nupkg" -k ${{ secrets.API_NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json
33+
run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{steps.login.outputs.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)