Skip to content

Conversation

@micheloliveira-com
Copy link
Contributor

Pull request description

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 (bUnit in this case).
  • The old secrets.NUGET_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. bUnit).
    • Repository owner: your GitHub org/user (e.g. bUnit-dev).
    • Repository name: repository name (e.g. bUnit).
    • Workflow file: the YAML file under .github/workflows/ (e.g. ci.yml / release.yml).
    • Environment (optional): specify if your workflow uses GitHub Actions environments.

Note: Two policies may need to be created—one for ci.yml and another for release.yml.

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

PR meta checklist

  • Pull request is targeted at main branch for code
    or targeted at stable branch for documentation that is live on bunit.dev.
  • Pull request is linked to all related issues, if any.
  • I have read the CONTRIBUTING.md document.

Code PR specific checklist

  • My code follows the code style of this project and AspNetCore coding guidelines.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have updated the appropriate sub section in the CHANGELOG.md.
  • I have added, updated or removed tests to according to my changes.
  • All tests passed.

@egil
Copy link
Member

egil commented Sep 27, 2025

Thanks. Will have a look at setting this up today.

@egil egil enabled auto-merge (squash) October 3, 2025 15:10
@egil egil merged commit 0218349 into bUnit-dev:main Oct 3, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants