Skip to content

Commit e44a258

Browse files
committed
chore(ci): enable OIDC login for NuGet publish
Adds OIDC-based NuGet login before publishing and conditionally uses the OIDC-provided API key for the official NuGet feed while falling back to existing secrets for other feeds. - Adds an OIDC authentication step prior to package publish. - Uses the OIDC token for api-key and symbol-api-key when targeting the official NuGet source. - Retains secret-based keys for other package sources. - Improves security by reducing reliance on long-lived secrets and enabling ephemeral credentials.
1 parent f20762c commit e44a258

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/nuget-publish.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,19 @@ jobs:
7474
subject-path: "${{ env.YumeChan_PluginsLocation }}/**/*nupkg"
7575

7676
# Publish
77+
78+
- name: NuGet login (OIDC)
79+
uses: NuGet/login@v1
80+
id: login
81+
with:
82+
user: ${{ secrets.NUGET_USER }}
83+
84+
7785
- name: Publish packages to ${{ matrix.nuget.name }}
7886
run: |
7987
dotnet nuget push "${{ env.YumeChan_PluginsLocation }}/**/*.nupkg" \
8088
--source "${{ matrix.nuget.source }}" \
8189
--symbol-source "${{ matrix.nuget.source }}" \
82-
--api-key "${{ secrets[matrix.nuget.keyname] }}" \
83-
--symbol-api-key "${{ secrets[matrix.nuget.keyname] }}" \
90+
--api-key "${{ matrix.nuget.name == 'NuGet' && steps.login.outputs.NUGET_API_KEY || secrets[matrix.nuget.keyname] }}" \
91+
--symbol-api-key "${{ matrix.nuget.name == 'NuGet' && steps.login.outputs.NUGET_API_KEY || secrets[matrix.nuget.keyname] }}" \
8492
--skip-duplicate

0 commit comments

Comments
 (0)