Continuous Deployment using just Netlify

How to set up deployment of a Record Collector site using only Netlify.

I was very happy to notice that the Netlify build-image now has the .NET 5.0.200 SDK installed.

For Record Collector this means that you can get deploys done where Netlify pulls from a Git repository and does the build.

So no need to handle API keys and an external build agent any more.

You just use the built-in Netlify features to give access to your Git repository when adding your site.

Paths to use in configuration

First go to Build & deploy and add an Environment variable. Set the key ASPNETCORE_ENVIRONMENT and value to Netlify.

This means the config used will come from appsettings.Netlify.json and this is how I've configured the sample site in that file.

{
  "AppSettings": {
    "SiteUrl": "https://record-collector.netlify.app/",
    "ContentRootPath": "/opt/build/repo/docs/content-record-collector-net/",
    "StaticSiteRootPath": "/opt/build/repo/artifacts/static-site/",
    "ViewPrefix": "",
    "SectionsToExcludeFromLists": [ "pages", "sidor" ],
    "MainNavigationSections": [ "pages", "sidor" ],
    "PaginationPageCount": 2,
    "PaginationPageSize": 3
  }
}

Build settings in Netlify

These are settings that work well with the sample site.

Setting Value
Base directory Leave empty
Build command dotnet test ./src/Krompaco.RecordCollector.Generator/Krompaco.RecordCollector.Generator.csproj --logger "console;verbosity=detailed"
Publish directory artifacts/static-site/
Builds Activate builds

You should also be able to push a Shell script and have more work done, for example building front-end stuff before generating the static site using npm run or similar. The build-image has support for a wide variety of languages and runtimes.

Netlify Status

This is such a great feature and really excited that it works this well with Record Collector! Thank you Netlify!

Deployment Automation
Johan Kronberg

Johan Kronberg