Skip to content

Commit 32b8893

Browse files
Use NuGet Trusted Publishing (#266)
Switch to using GitHub OIDC for pushing packages to NuGet.org with Trusted Publishing. Resolves #264.
1 parent 9fc887a commit 32b8893

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,21 @@ jobs:
200200
dotnet-version: ${{ needs.build-test.outputs.dotnet-sdk-version }}
201201

202202
- uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # get-vault-secrets/v1.3.0
203-
id: get-token
203+
id: get-user
204204
with:
205205
export_env: false
206206
repo_secrets: |
207-
token=nuget:token
207+
user=nuget:user
208+
209+
- name: NuGet log in
210+
uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544 # v1.1.0
211+
id: nuget-login
212+
with:
213+
user: ${{ fromJSON(steps.get-user.outputs.secrets).user }}
208214

209215
- name: Push NuGet packages to NuGet.org
210216
shell: bash
211217
env:
212-
API_KEY: ${{ fromJSON(steps.get-token.outputs.secrets).token }}
218+
API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
213219
SOURCE: 'https://api.nuget.org/v3/index.json'
214220
run: dotnet nuget push "*.nupkg" --api-key "${API_KEY}" --skip-duplicate --source "${SOURCE}"

0 commit comments

Comments
 (0)