Skip to content

Modernize GitHub workflows and finish move to NuGet trusted publishing #6

Done

Description

@ardalis

Summary

Bring the GitHub Actions workflows up to date and make NuGet trusted publishing (OIDC) the only way packages get published.

Current state

  • publish.yml already has id-token: write and uses NuGet/login@v1 to swap an OIDC token for a short-lived API key. However:
    • The trusted publishing policy on nuget.org hasn't been confirmed. The workflow has never run successfully (no runs in history).
    • The old long-lived NUGET_API_KEY repo secret (from 2024-10) is still there.
    • The login step runs on every trigger, including workflow_dispatch on a branch, even though the push step only runs for tags.
  • ci.yml only runs when src/** changes, so changes to tests/**, Directory.*.props or workflow files skip CI.
  • Update to .NET 11 and latest dependencies #4 bumps the SDK to 11.0.x, actions/checkout to v7 and actions/setup-dotnet to v6, and nothing else.

Tasks

Trusted publishing

  • On nuget.org, add or verify a trusted publishing policy for NimblePros.SharedKernel: owner NimblePros, repo SharedKernelSample, workflow publish.yml, and an environment if we add one
  • Pin NuGet/login to the latest release (v1.2.0) or to a commit SHA
  • Only run the login and push steps for tag/release refs
  • Optionally add a protected nuget GitHub environment (with required reviewers) and tie the trusted publishing policy to it
  • After a successful trusted publish, delete the NUGET_API_KEY secret and revoke that key on nuget.org

Workflow modernization

  • ci.yml: also trigger on tests/**, Directory.*.props, *.slnx and .github/workflows/**
  • Add least-privilege permissions: (contents: read) to ci.yml
  • Add concurrency so a new push cancels older in-progress CI runs
  • Cache NuGet packages (actions/setup-dotnet cache: true with a lock file, or actions/cache)
  • Publish test results and coverage (coverlet is already referenced)
  • Consider pinning actions to commit SHAs and adding Dependabot for github-actions and nuget
  • Consider having publish.yml reuse ci.yml instead of duplicating the build and test steps

Notes

🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions