Skip to content

Commit fdc6c75

Browse files
authored
Use new GitHub OIDC token for publish (#29)
1 parent a9b452a commit fdc6c75

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/publish_to_NuGet.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,23 @@ on:
77
jobs:
88
publish:
99
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write # enable GitHub OIDC token issuance for this job
1012

1113
steps:
1214
- uses: actions/checkout@v6
1315

1416
- run: dotnet restore
1517
- run: dotnet build --configuration Release --no-restore --warnaserror
1618
- run: dotnet pack --configuration Release -o out/Release -p:PackageVersion=${GITHUB_REF/refs\/tags\/v/''}
17-
- run: dotnet nuget push out/Release/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json
19+
20+
# Get a short-lived NuGet API key
21+
- name: NuGet login (OIDC → temp API key)
22+
uses: NuGet/login@v1
23+
id: login
24+
with:
25+
user: ${{ secrets.NUGET_USER }}
26+
27+
# Push the package
28+
- name: NuGet push
29+
run: dotnet nuget push out/Release/*.nupkg --skip-duplicate --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)