Switch NuGet publishing to OIDC trusted publishing#213
Merged
Conversation
Replace secret-based NUGET_API_KEY with nuget/login OIDC flow. Also adds workflow_dispatch trigger for manual releases and uploads build artifacts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the NuGet release workflow to publish Plugin.Maui.Audio packages using NuGet.org OIDC trusted publishing (via nuget/login@v1) instead of a long-lived API key secret.
Changes:
- Adds
workflow_dispatchsupport with a manualversioninput for releases. - Switches authentication to NuGet OIDC (
nuget/login@v1) and pushes with--skip-duplicate. - Uploads generated
.nupkgfiles as a workflow artifact.
Comment on lines
+11
to
+12
| - "v[0-9]+.[0-9]+.[0-9]+" | ||
| - "v[0-9]+.[0-9]+.[0-9]+-preview[0-9]+" |
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write |
| "version-without-v=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | ||
| $tagOrInput = "${{ inputs.version != '' && inputs.version || github.ref_name }}" | ||
| $version = $tagOrInput.TrimStart("v") | ||
| dotnet pack src\Plugin.Maui.Audio\Plugin.Maui.Audio.csproj -c Release -p:PackageVersion=$version -o artifacts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the secret-based
NUGET_API_KEYapproach with NuGet's OIDC trusted publishing vianuget/login@v1.Changes:
nuget/login@v1for OIDC-based authentication (no API key secret needed)id-token: writepermission for OIDCworkflow_dispatchtrigger for manual releases with version input.nupkgas build artifactVerify commit exists in origin/mainstep (tag-based triggers already ensure this)--skip-duplicatefor idempotent pushesPrerequisites: The NuGet.org trusted publisher must be configured for this repository at https://www.nuget.org/packages/Plugin.Maui.Audio/manage