Skip to content

Commit ec0f1c9

Browse files
committed
Migrating delivery workflows to NuGet Trusted Publishing
1 parent fbd5bc8 commit ec0f1c9

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

.github/workflows/cd.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,30 @@ on:
33
push:
44
tags:
55
- "v[0-9]+.[0-9]+.[0-9]+"
6+
permissions:
7+
contents: read
8+
id-token: write
69
jobs:
710
deployment:
811
runs-on: windows-latest
912
steps:
1013
- name: Checkout
11-
uses: actions/checkout@v4
14+
uses: actions/checkout@v6
1215
- name: Extract VERSION
1316
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
1417
shell: bash
15-
- name: Setup .NET 6.0 SDK
16-
uses: actions/setup-dotnet@v4
17-
with:
18-
dotnet-version: '6.0.x'
19-
- name: Setup .NET 7.0 SDK
20-
uses: actions/setup-dotnet@v4
21-
with:
22-
dotnet-version: '7.0.x'
2318
- name: Setup .NET 8.0 SDK
24-
uses: actions/setup-dotnet@v4
19+
uses: actions/setup-dotnet@v5
2520
with:
2621
dotnet-version: '8.0.x'
22+
- name: Setup .NET 9.0 SDK
23+
uses: actions/setup-dotnet@v5
24+
with:
25+
dotnet-version: '9.0.x'
26+
- name: Setup .NET 10.0 SDK
27+
uses: actions/setup-dotnet@v5
28+
with:
29+
dotnet-version: '10.0.x'
2730
- name: Restore
2831
run: dotnet restore
2932
- name: Build
@@ -32,8 +35,13 @@ jobs:
3235
run: dotnet test --configuration Release --no-build
3336
- name: Pack
3437
run: dotnet pack --configuration Release --no-build
38+
- name: Log in to NuGet
39+
uses: NuGet/login@v1
40+
id: nuget-login
41+
with:
42+
user: ${{ secrets.NUGET_USER }}
3543
- name: NuGet Push Lib.AspNetCore.ServerSentEvents
3644
run: dotnet nuget push Lib.AspNetCore.ServerSentEvents/bin/Release/Lib.AspNetCore.ServerSentEvents.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_API_KEY}
3745
shell: bash
3846
env:
39-
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
47+
NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }}

0 commit comments

Comments
 (0)