仅根据特定文件夹中的更改从 Appveyor 部署到 Nuget

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

我有一个在 Appveyor 中自动构建并部署到 Nuget 的 .NET Core 项目。默认情况下,每次成功构建都会导致新的 Nuget 发布。

但是,很多情况下新版本是没有意义的,因为库的实际代码没有改变:

是否可以配置构建,以便 Nuget 发布仅在实际代码发生变化时运行(例如,在文件夹 X 中)?

有几个选项。

  • Commit filtering。请注意,如果文件夹 x 中没有任何内容发生变化,则整个构建,而不仅仅是部署将被跳过。至少在添加单元测试时,您可能需要一个没有部署的构建。作为一种解决方法,请考虑添加单独的 AppVeyor 项目,该项目仅在文件夹 x 发生更改时才会构建和部署,并保持当前项目每次都构建,但不部署

  • 使用脚本检查更改的文件。请检查 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.