This repo is aiming to become a small installable project template I can use to easily spin up new repos with tested, publishable class libraries, published as nuget packages.
This is a work in progress.
- GitVersion - https://gitversion.net/
- Github Actions - https://docs.github.com/en/actions
- Github Packages - https://docs.github.com/en/packages (Actually now publishing to myget)
- Cake Build - https://cakebuild.net/
- Dotnet Pack - https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack
- Dotnet Custom Templates (MSBuild) - https://learn.microsoft.com/en-us/dotnet/core/tools/custom-templates
TODO: Token generation, storage and injection into GHA.
Install: dotnet new install ./templates/ --force
Create New Tested Library Project: dotnet new Template.TestedLibrary --ProjectName={ProjectName}
Create New DbApi Project: dotnet new Template.DbApi --ProjectName={ProjectName}
Uninstall: dotnet new uninstall ./templates/
Run: dotnet cake template.cake --Target=InstallAndTestTemplate
Run: dotnet cake template.cake --Target=PackAndPushTemplate --Source={Source} --ApiKey={key}
Packages currently publish to my personal feed by default: https://www.myget.org/F/tr-public/api/v3/index.json
Setup package feed:
dotnet nuget add source https://www.myget.org/F/tr-public/api/v3/index.json --name TR.Packages
Install Template Package:
dotnet new install TR.Templates --nuget-source TR.Packages --force
Create new project:
dotnet new Template.TestedLibrary --ProjectName={MyProjectName}
If you want to fork this and push your template to your own package feed, you'll need to configure the following in your repo:
- Create your personal NuGet feed
- Generate / lookup the API key for feed
- Go to your repository
settings
=>Secrets and variables
=>Actions
- Under
Variables
/Repository Variables
, createNUGET_SOURCE
and put your package source package URL here. - Under
Secrets
, createNUGET_APIKEY
and put your package source API key here. - These feed into
Github Actions
and are injected into theCake Build
step. - When the GHA run the
PackAndPushTemplate
your package will be generated and pushed to the feed.