Skip to content

Commit 474155a

Browse files
authored
Improve nuget release security (#22)
1 parent a447ce0 commit 474155a

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Release
22

33
on:
44
release:
@@ -10,7 +10,10 @@ env:
1010
NUGET_PATH: './**/IeuanWalker.Maui.Breadcrumb.${{ github.event.release.tag_name }}.nupkg'
1111

1212
jobs:
13-
build:
13+
build-and-publish:
14+
permissions:
15+
id-token: write # enable GitHub OIDC token issuance for this job
16+
1417
runs-on: windows-latest
1518

1619
steps:
@@ -42,7 +45,14 @@ jobs:
4245
path: ${{ env.NUGET_PATH }}
4346

4447
- name: Setup NuGet
45-
uses: NuGet/setup-nuget@v1.0.6
48+
uses: NuGet/setup-nuget@v1.1.1
4649

50+
# Get a short-lived NuGet API key
51+
- name: NuGet login (OIDC → temp API key)
52+
uses: NuGet/login@v1
53+
id: login
54+
with:
55+
user: Ieuan
56+
4757
- name: Publish
48-
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
58+
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{steps.login.outputs.NUGET_API_KEY}}

0 commit comments

Comments
 (0)