Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(actions): add nuget trusted publishing #631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
micheloliveira-com wants to merge 2 commits into passwordless-lib:main
base: main
Choose a base branch
Loading
from micheloliveira-com:feature/nuget-trusted-publishing

Conversation

@micheloliveira-com
Copy link

@micheloliveira-com micheloliveira-com commented Sep 26, 2025
edited
Loading

Motivation

As described in the official announcement, the new Trusted Publishing feature greatly enhances package publishing security on NuGet.org.

We successfully tested this approach with our own NuGet library:

Required changes in this repository

Recommendation followed from announcement:
For security, always use a GitHub secret like ${{ secrets.NUGET_USER }} for your NuGet.org username (profile name), not your email address.

  • Add secrets.NUGET_USER to this repository, using the NuGet.org username (profile name) of the package owner (abergs in this case).
  • The old secrets.NUGET_API_KEY secret can be removed from this repository and also from the NuGet.org account if it was only used here.

One-time configuration on NuGet.org

According to the documentation:

  1. Sign in to NuGet.org.
  2. Open your user menu (top-right) → Trusted Publishing (next to "API Keys").
  3. Create a policy:
    • Package owner: you or your organization (e.g. abergs).
    • Repository owner: your GitHub org/user (e.g. passwordless-lib).
    • Repository name: repository name (e.g. fido2-net-lib).
    • Workflow file: the YAML file under .github/workflows/ (e.g. main.yml).
    • Environment (optional): specify if your workflow uses GitHub Actions environments.

This setup eliminates the need for long-lived API keys and improves the overall security of the publishing process.

Copy link
Author

Note: I think leaving NuGet/login without a SHA hash is fine since it's an official Microsoft action.

  • Forcing a SHA might break in future core NuGet changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /