Skip to content

Commit 664dc4a

Browse files
committed
ci: use NuGet trusted publishing (OIDC) instead of a stored API key
1 parent c23c79b commit 664dc4a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎.github/workflows/publish.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
push:
44
tags: ['v*']
55
workflow_dispatch:
6+
permissions:
7+
id-token: write
8+
contents: read
69
jobs:
710
publish:
811
runs-on: ubuntu-latest
@@ -11,8 +14,13 @@ jobs:
1114
- uses: actions/setup-dotnet@v4
1215
with:
1316
dotnet-version: '8.0.x'
17+
- name: NuGet trusted publishing login (OIDC)
18+
uses: NuGet/login@v1
19+
id: login
20+
with:
21+
user: AZcom
1422
- run: dotnet restore
1523
- run: dotnet build -c Release --no-restore
1624
- run: dotnet pack src/IPDataInfo.Sdk/IPDataInfo.Sdk.csproj -c Release --no-build -o out
1725
- name: Push to NuGet
18-
run: dotnet nuget push "out/*.nupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
26+
run: dotnet nuget push "out/*.nupkg" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)