File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,17 +31,13 @@ jobs:
3131 - name : Publish NuGet Packages to GitHub Packages
3232 run : dotnet nuget push bin/artifacts/**/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate
3333
34+ - name : NuGet login (OIDC → temp API key)
35+ if : github.event_name == 'release'
36+ uses : NuGet/login@v1
37+ id : login
38+ with :
39+ user : ${{ secrets.NUGET_USER }}
40+
3441 - name : Publish NuGet package
3542 if : github.event_name == 'release'
36- run : |
37- OIDC_TOKEN=$(curl --silent --show-error --fail-with-body \
38- --url "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=api://AzureADTokenExchange" \
39- --header "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
40- | jq --raw-output '.value')
41- API_KEY=$(curl --silent --show-error --fail-with-body \
42- --request POST \
43- --url "https://api.nuget.org/v1/authentication/authenticate" \
44- --header "Content-Type: application/json" \
45- --data "{\"oidcToken\": \"$OIDC_TOKEN\"}" \
46- | jq --raw-output '.apiKey')
47- dotnet nuget push bin/artifacts/**/*.nupkg --api-key "$API_KEY" --source "https://api.nuget.org/v3/index.json" --skip-duplicate
43+ run : dotnet nuget push bin/artifacts/**/*.nupkg --api-key "${{ steps.login.outputs.apiKey }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate
You can’t perform that action at this time.
0 commit comments