Skip to content

Commit caada99

Browse files
MichaCMichaC
authored andcommitted
trying out Trusted Publishing
1 parent ec43b5c commit caada99

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
branches: [ main ]
1111
workflow_dispatch:
1212

13+
permissions:
14+
id-token: write # required for GitHub OIDC
15+
1316
jobs:
1417
build-and-test:
1518
name: Build and Test (${{ matrix.os }})
@@ -99,6 +102,7 @@ jobs:
99102
if: startsWith(github.ref, 'refs/tags/v')
100103
permissions:
101104
contents: read
105+
id-token: write # required for OIDC Trusted Publishing
102106

103107
steps:
104108
- name: Checkout
@@ -125,7 +129,11 @@ jobs:
125129
$version = "${{ github.ref_name }}" -replace '^v', ''
126130
dotnet pack src/CDT.Core/CDT.Core.csproj --no-build -c Release -o ./artifacts /p:Version=$version
127131
132+
- name: NuGet login
133+
uses: NuGet/login@v1
134+
id: login
135+
with:
136+
user: MichaConrad
137+
128138
- name: Push to NuGet.org
129-
# Requires a NUGET_API_KEY secret configured in:
130-
# GitHub → Repository Settings → Secrets and variables → Actions → New repository secret
131-
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
139+
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)