Skip to content

Commit 68c7fe2

Browse files
committed
Enable Trusted Publishing for NuGet with OIDC Authentication in CI workflow
1 parent f960de7 commit 68c7fe2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ jobs:
6969
runs-on: ubuntu-latest
7070
needs: build
7171
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
72+
permissions:
73+
id-token: write # Required for Trusted Publishing (OIDC token generation)
7274

7375
steps:
7476
- name: Install .NET 8.0
@@ -82,6 +84,12 @@ jobs:
8284
name: nuget-package
8385
path: ./packages
8486

87+
# Authenticate to NuGet.org using Trusted Publishing (OIDC)
88+
- name: Login to NuGet
89+
uses: NuGet/login@v1
90+
with:
91+
user: ${{ secrets.NUGET_USERNAME }}
92+
8593
# Only push tagged builds to NuGet. These will be production or release candidates.
8694
- name: Publish to NuGet
87-
run: dotnet nuget push ./packages/SaturdayMP.XPlugins.iOS.BEMCheckBox.${{ needs.build.outputs.version }}.nupkg -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate --no-symbols -s https://api.nuget.org/v3/index.json
95+
run: dotnet nuget push ./packages/SaturdayMP.XPlugins.iOS.BEMCheckBox.${{ needs.build.outputs.version }}.nupkg --skip-duplicate --no-symbols -s https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)