Skip to content

Commit 56ac6a8

Browse files
authored
Merge pull request #372 from BUTR/trusted-publishing
ci: switch NuGet publishing to Trusted Publishing (OIDC)
2 parents b010ab4 + 89578a6 commit 56ac6a8

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/publish-nuget.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
- 'src/Bannerlord.ModuleManager/**.cs'
1010
workflow_dispatch:
1111

12+
permissions:
13+
id-token: write
14+
contents: read
15+
packages: write
16+
1217
jobs:
1318
publish:
1419
name: Publish on NuGet and GPR
@@ -29,8 +34,14 @@ jobs:
2934

3035
- run: dotnet pack -c Release src/Bannerlord.ModuleManager.Source -p:VersionOverride=$(git rev-list --no-merges --count master) -o ./packages
3136

37+
- name: NuGet login (trusted publishing)
38+
uses: NuGet/login@v1
39+
id: nuget-login
40+
with:
41+
user: Aragas
42+
3243
- name: Push to NuGet
33-
run: dotnet nuget push "./packages/*.nupkg" -k ${{secrets.NUGET_API_KEY}} -s https://www.nuget.org --skip-duplicate
44+
run: dotnet nuget push "./packages/*.nupkg" -k ${{ steps.nuget-login.outputs.NUGET_API_KEY }} -s https://www.nuget.org --skip-duplicate
3445
shell: pwsh
3546

3647
- name: Push to GPR

0 commit comments

Comments
 (0)