Skip to content

Commit 68cd795

Browse files
aaronpowellCopilot
andauthored
Use trusted publishing for beta NuGet pushes (#1452)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 8b59e42 commit 68cd795

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎.github/workflows/dotnet-main.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ jobs:
106106
runs-on: ubuntu-latest
107107
environment:
108108
name: nuget-beta
109+
permissions:
110+
id-token: write
111+
contents: read
109112
# Only run publish when the merged PR does NOT contain the skip label.
110113
# The label name is configurable via the `SKIP_PUBLISH_LABEL` env in the detector job below.
111114
if: needs.detect-pr-label.outputs.skip_publish != 'true'
@@ -115,8 +118,14 @@ jobs:
115118
with:
116119
name: signed-nuget-packages
117120

121+
- name: NuGet login (OIDC)
122+
id: login
123+
uses: NuGet/login@v1
124+
with:
125+
user: ${{ secrets.NUGET_USER }}
126+
118127
- name: Publish to NuGet
119-
run: dotnet nuget push ./*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_PACKAGE_PUSH_TOKEN }}
128+
run: dotnet nuget push ./*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --skip-duplicate
120129

121130
publish-azure-artifacts:
122131
needs: [sign, detect-pr-label]

0 commit comments

Comments
 (0)