Deploy Build
This article gives an overview of the deployment instruments offered by TeamCity.
Most often, a deployment build is a finishing stage of a pipeline, or build chain. However, if your project is rather simple and you build it with a single configuration, you can deploy its result with just the final step of this configuration — it's totally up to you.
Depending on your environment, all the deployment processes can be executed on a build agent or in any third-party system.
Deployment Build Configuration
When you create or edit a build configuration, you can change its type from Regular to Composite or Deployment. We talked about composite builds in the previous tutorial. Unlike them, deployment builds work almost like regular ones: you can add the same steps and features or tweak the same settings. In addition to that, a deployment config offers several enhancements for an easier and transparent workflow:
The Run button of such a build changes to Deploy.
All dependency builds get an extra Deployments section of Build Results, from where you can quickly deploy the product.
Personal builds are disabled to prevent any accidental deployment.
See more details about these and other features of such builds.
We suggest that you always use deployment configurations to deliver your software to production.
Ways to Deploy Product with TeamCity
Here's how you can deploy your build artifacts:
Via a command line, using any general runner like Command Line or PowerShell. This is the most straightforward approach. Just add a build step, select any such runner, and enter commands as if in a regular terminal. The benefits you get from TeamCity in this case are flexible automation, synchronization with the previous build stages, and a convenient view of build results in the TeamCity UI.
This way, you can also update distribution files in a third-party storage, like Amazon S3.
Using a specific runner for your platform. For example, if you build .NET projects, the best way to deploy them is via our .NET runner. It supports all the relevant .NET commands such as
pack
orpublish
and offers a variety of other features. Other runners are listed under this section.Using a deployer. TeamCity offers several build runners dedicated to deployment: SMB Upload, FTP Upload, SSH Upload, and SSH Exec. They can upload build artifacts via different protocols and let you configure this upload process in the TeamCity UI.
Takeaway
It is convenient to create a dedicated deployment configuration at the end of the build chain.
To deploy a product from TeamCity, you need to add a build step and choose its runner based on your preferred solution.