Skip to content

Commit 234e34d

Browse files
committed
Switch to NuGet Trusted Publishing
1 parent a0fe97a commit 234e34d

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,10 @@ jobs:
1515
release:
1616
runs-on: ubuntu-24.04
1717
permissions:
18-
actions: read
19-
contents: write
18+
actions: read # Required to download artifacts
19+
contents: write # Upload artifacts to Release
20+
id-token: write # Required for NuGet CLI Login
2021
steps:
21-
- name: ⚙️ Initialization
22-
shell: pwsh
23-
run: |
24-
if ('${{ secrets.NUGET_API_KEY }}') {
25-
Write-Host "NUGET_API_KEY secret detected. NuGet packages will be pushed."
26-
echo "NUGET_API_KEY_DEFINED=true" >> $env:GITHUB_ENV
27-
}
28-
2922
- name: 🔎 Search for build of ${{ github.ref }}
3023
shell: pwsh
3124
id: findrunid
@@ -82,6 +75,11 @@ jobs:
8275
gh release -R ${{ github.repository }} upload "${{ github.ref_name }}" $_.FullName
8376
}
8477
78+
- name: 🪪 Authorize NuGet package push
79+
uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544 # v1
80+
id: nuget-login
81+
with:
82+
user: ${{ secrets.NUGET_USER }}
83+
8584
- name: 🚀 Push NuGet packages
86-
run: dotnet nuget push ${{ runner.temp }}/deployables/*.nupkg --source https://api.nuget.org/v3/index.json -k '${{ secrets.NUGET_API_KEY }}'
87-
if: ${{ env.NUGET_API_KEY_DEFINED == 'true' }}
85+
run: dotnet nuget push ${{ runner.temp }}/deployables/*.nupkg --source https://api.nuget.org/v3/index.json -k '${{ steps.nuget-login.outputs.NUGET_API_KEY }}'

0 commit comments

Comments
 (0)