Skip to content

Commit 4ac7bc3

Browse files
authored
Merge pull request #46 from LuccaSA/seguins-patch-1
Update NuGet push process with OIDC login
2 parents d19bea3 + 916623a commit 4ac7bc3

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/dotnetcore.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
jobs:
1111
build:
1212
runs-on: windows-latest
13+
permissions:
14+
id-token: write
15+
contents: read
1316

1417
steps:
1518
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
@@ -64,9 +67,14 @@ jobs:
6467
- name: Pack MerQure.Tools
6568
run: dotnet pack src\MerQure.Tools\MerQure.Tools.csproj --configuration Release -o artifacts -p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersionV2 }}
6669

67-
- name: Nuget org push
68-
if: startsWith(github.ref, 'refs/tags/')
69-
run: dotnet nuget push "artifacts/**/*.nupkg" --skip-duplicate --source https://api.nuget.org/v3/index.json -k ${{ secrets.GLOBAL_NUGET_PUBLISH }}
70-
env:
71-
NUGET_PUBLISH: ${{ secrets.NUGET_PUBLISH }}
70+
# https://learn.microsoft.com/fr-fr/nuget/nuget-org/trusted-publishing
71+
- name: NuGet login (OIDC → temp API key)
72+
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 #v1.2.0
73+
id: login
74+
with:
75+
user: ${{ secrets.NUGET_USER }}
76+
77+
# Push the package
78+
- name: NuGet push
79+
run: dotnet nuget push "artifacts/**/*.nupkg" --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{steps.login.outputs.NUGET_API_KEY}}
7280

0 commit comments

Comments
 (0)