How can I have teamcity run a .bat file on each successful build?

◇◆丶佛笑我妖孽 提交于 2019-12-06 05:23:40

In more recent versions of TeamCity...

In the build definition you can identify artifacts which can be copied/zipped. Artifacts can then be downloaded manually or referenced from another build (Artifact Dependency).

You can setup a 'build configuration' to do your deployment directly from artifacts produced by your ci build.

  • Create a build to do your deployment
  • Build Step
    • Run: Executable with parameters
    • Command executable: .bat file (make sure it as part of the ci build artifacts generated)
    • Command parameters: whatever parameters your patch files needs
  • Dependencies
    • Add New Artifact dependency
    • Depend on: select the ci build you want to deploy
    • GetArtifacts from: Last successful build
    • Artifact rules: +:**/*.*

So, given artifacts (like your batch file) are in the CI build... You now have a 'deploy' build. When you run it (manually or setup a Build Trigger) it will copy all the CI build artifacts to it's working directory (Artifact Dependency) and then run your batch file to do the deployment.

Pretty slick.

note: just make sure that the account running the TeamCity BuildAgent has permissions to do all the deployment stuff.

Hope this helps somebody as it took me a while to sort this out ;)

Jarrett Meyer

I've done this by creating a nant task, and then having TeamCity execute the nant task. It's more of a pain than it should be. You should be able to do the same as a post-build event with MSBuild.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!