Skip to content

Commit 8277555

Browse files
authored
Switch to nuget OIDC publishing (#3764)
1 parent e4e9293 commit 8277555

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212

1313
permissions:
1414
contents: read
15+
id-token: write # required for GitHub OIDC
1516

1617
env:
1718
postgis_version: 3
@@ -165,6 +166,8 @@ jobs:
165166
needs: build
166167
runs-on: ubuntu-24.04
167168
if: github.event_name == 'push' && startsWith(github.repository, 'npgsql/') && needs.build.outputs.is_release == 'true'
169+
permissions:
170+
id-token: write # enable GitHub OIDC token issuance for this job
168171
environment: nuget.org
169172

170173
steps:
@@ -185,6 +188,13 @@ jobs:
185188

186189
# TODO: Create a release
187190

191+
# Get a short-lived NuGet API key
192+
- name: NuGet login (OIDC)
193+
uses: NuGet/login@v1
194+
id: login
195+
with:
196+
user: ${{ secrets.NUGET_USER }}
197+
188198
- name: Publish to nuget.org
189-
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json
199+
run: dotnet nuget push "*.nupkg" --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
190200
working-directory: nupkgs

0 commit comments

Comments
 (0)