Skip to content

Commit 4fff423

Browse files
authored
Add NuGet login step for package publishing (#301)
This prevents us from having to rotate NuGet publishing keys, as one is retrieved on-demand. Docs are at https://learn.microsoft.com/en-us/nuget/nuget-org/trusted-publishing#github-actions-setup.
1 parent 9981ee6 commit 4fff423

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ jobs:
3939
version: ${{ steps.tag_name.outputs.current_version }}
4040
path: ./CHANGELOG.md
4141

42+
- name: Get NuGet Publishing Key
43+
uses: NuGet/login@v1
44+
id: nuget-login
45+
with:
46+
user: ${{secrets.NUGET_USER}}
47+
4248
- name: Create Release
4349
uses: ncipollo/release-action@v1
4450
if: ${{ !contains(steps.tag_name.outputs.current_version, '-MsBuild') }}
@@ -49,4 +55,4 @@ jobs:
4955
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
5056

5157
- name: Push packages
52-
run: dotnet nuget push "**/*.nupkg" -s "https://api.nuget.org/v3/index.json" -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate
58+
run: dotnet nuget push "**/*.nupkg" -s "https://api.nuget.org/v3/index.json" ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --skip-duplicate

0 commit comments

Comments
 (0)