Skip to content

Commit 79e5f64

Browse files
feat: switch deploy to NuGet trusted publishing (OIDC)
- Add permissions.id-token: write to deploy job to enable OIDC token issuance - Add NuGet/login@v1 step to exchange GitHub OIDC token for a short-lived NuGet API key - Replace long-lived secrets.NUGET_API_KEY with steps.login.outputs.NUGET_API_KEY - Fix deprecated ::set-output syntax to use GITHUB_OUTPUT - Update .NET setup in deploy job to use global-json-file instead of hardcoded versions - Fix CI env var leak in CIDetectionTests causing NoCiEnvVars_SetsCIPropertyToFalse to fail on GitHub Actions
1 parent 7a486ad commit 79e5f64

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ jobs:
1919
- name: Setup .NET
2020
uses: actions/setup-dotnet@v5
2121
with:
22-
dotnet-version: |
23-
3.1.x
24-
8.x
22+
global-json-file: global.json
2523
- name: Restore dependencies
2624
run: dotnet restore
2725
- name: Set Version
@@ -57,17 +55,25 @@ jobs:
5755
environment:
5856
name: 'Production'
5957
url: 'https://www.nuget.org/packages/IntelliTect.Multitool'
58+
permissions:
59+
id-token: write
6060
steps:
6161
- name: Download artifact from build job
6262
uses: actions/download-artifact@v7
6363
with:
6464
name: NuGet
65-
- name: Push NuGet
65+
- name: Get tag version
66+
id: tag-version
6667
run: |
6768
$tagVersion = "${{ github.ref }}".substring(11)
68-
echo "::set-output name=TAG_VERSION::$tagVersion"
69-
dotnet nuget push IntelliTect.Multitool.$tagVersion.nupkg --source https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate
70-
id: tag-version
69+
echo "TAG_VERSION=$tagVersion" >> $env:GITHUB_OUTPUT
70+
- name: NuGet login
71+
uses: NuGet/login@v1
72+
id: login
73+
with:
74+
user: ${{ secrets.NUGET_USER }}
75+
- name: Push NuGet
76+
run: dotnet nuget push IntelliTect.Multitool.${{ steps.tag-version.outputs.TAG_VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --skip-duplicate
7177
- name: Upload nupkg to Releases
7278
uses: softprops/action-gh-release@v2
7379
with:

0 commit comments

Comments
 (0)