Skip to content

Commit 9f998d3

Browse files
authored
Update preview-release.yml to use trusted publishing
1 parent fb9f521 commit 9f998d3

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/preview-release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
release-preview:
99
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
1010
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write # enable GitHub OIDC token issuance for this job
1113

1214
steps:
1315
- uses: actions/checkout@v5
@@ -23,5 +25,11 @@ jobs:
2325
run: dotnet build -c Release --no-restore
2426
- name: Pack TwitchLib.EventSub.Websockets
2527
run: dotnet pack ./TwitchLib.EventSub.Websockets/TwitchLib.EventSub.Websockets.csproj -v normal -c Release -o nugets --no-build --version-suffix "preview.${{ github.run_number }}.${{ steps.short-sha.outputs.sha }}"
28+
# Get a short-lived NuGet API key
29+
- name: NuGet login (OIDC → temp API key)
30+
uses: NuGet/login@v1
31+
id: login
32+
with:
33+
user: ${{ secrets.NUGET_USER }}
2634
- name: Push to Nuget
27-
run: dotnet nuget push "./nugets/*.nupkg" -k ${{ secrets.API_NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json
35+
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)