Template repo for setting up a simple .NET library (nuget) show casing some common use cases:
- GitHub actions (CI, deploy)
- CI : Restore, build & unit tests via Xunit
- Pre-release:
- Automated publishing of pre-release versions to nuget.org
- Semver-versioning via GitVersion
- Manually triggered workflow
- Release:
- Same as Pre-release, + publish a Github release w/ release notes using the GitHub Release Notes API.
- A sensible
.editorconfigfor csharp - A sensible
.gitignorefor .NET projects - Commonly setup Nuget package contents:
- Package icon (embedded in nuget)
- Readme showing in nuget.org (embedded in nuget),
- Multi-targeting and conditional dependencies dep on TFM
- Bundling internal dependencies: peer dependencies/transient dependencies (project refs) as dlls in main nuget without publish of peer to nuget.org. See #2.
- Funding for GitHub Sponsors
- MIT License
The GitHub actions requirements:
- The sln file must be in
/source - For publish to work, set a GitHub Secret
NUGETORGAPIKEYfor nuget.org
- It builds & tests projects part of the sln found in
/source - Renaming the sln file does not impact the GitHub actions.
- Renaming any projects does not impact the GitHub actions.
- Publishing a pre-release version is done via manually triggering the
prereleaseGH action in any branch (input to the trigger). Versioning handled automatically by GitVersion. - Publishing a release version is done the same way: manually triggering the
releaseGH action.