Let's dive into a topic that resonates with many of us - the intricacies of NuGet package versioning and publishing.
The Challenge:
Whether you're working in an enterprise environment with various teams or developing libraries for the broader dev community, a consistent challenge is to design an efficient versioning strategy and publishing flow for shared code.
My Solution:
If you're grappling with this issue, I have a solution that has been working wonders for me - GitVersion and GitHub Actions. I've opted for GitHub Actions as it's integrated with my public GitHub repository, but once your packages are versioned and ready to go, you can set up similar flows with most tools.
What I've Created:
I've put together a sample repository to showcase this approach. Here's the overview:
- GitVersion is at the helm of package versioning. It calculates the current package version and sets up pre-release versions. This streamlines the testing process within your actual project.
- GitHub Actions choreograph the entire .NET build, pack, and publishing process. With this setup, each commit can become a potential release candidate, ensuring a regular, automated flow.
- Tweaking NuGet packages context within the
.csproj
file comes next. This includes adding a description, author details, tags, and more. - Lastly, the GitHub Actions workflow is connected to the public NuGet artifactory, facilitating package publishing.
Interested?
If this sounds useful, check out the repository here.