Search code examples
deploymentcontinuous-integrationnugetappveyor

Deploying from Appveyor to Nuget only on changes in a particular folder


I have a .NET Core project that is auto-built in Appveyor and deployed to Nuget. By default, every successful build causes a new Nuget release.

However, there are many cases when a new release is meaningless because the library's actual code has not changed:

  • Readme updated
  • Unit tests added
  • Appveyor configuration changed
  • Other cases

It is possible to configure the build so that Nuget publishing only runs if there are changes in the actual code (for example, in folder X)?


Solution

  • There are a few options.

    • Commit filtering. Note that with it the whole build, not just deployment will be skipped if nothing in folder x changed. You may need a build without deployment at least when unit tests added. As a workaround consider adding separate AppVeyor project which will build and deploy only if folder x changed and keep current project to build every time, but not deploy

    • Inspect changed files with script. Please check this sample on how to check those files if you use GitHub. So if you see that files in folder x changed, you can set some custom environment variable (lets say you call it deploy_nuget) to true, and use it with a conditional deployment.