How do I use automatic deployments with Codebase?

Last updated by Adam West on October 26, 2016 17:17

This article is going to describe a development and deployment workflow using Codebase and Deploy and provide instructions on how to set it up. The following scenario should work for Git and Mercurial users. Unfortunately, it doesn't apply to Subversion due to the lack of proper branches.

Every paid Codebase account comes with a free Deploy account. Deploy is a repository to server deployment solution. It can take a working copy of your repository and push the changed files since the previous deployment to your server via FTP or SFTP/SSH. If you haven't set yours up yet it can be activated from the Upgrade/Downgrade Package page from the Settings menu when logged in as the Account Administrator.

We'll assume your repository has 3 remote branches on Codebase; `master` (for development), `testing` and `production`. Development work can be done on local branches and merged into master before pushing, or directly onto `master`. We want to automatically deploy changes that are made to the `master` and `testing` branches, but not those on the `production` branch.

Assuming a 3-man development team, we want our repository and server layout to look something like this:

The first step is to create a new project in Deploy, and introduce it to our Codebase repository. At the top of the screen, chose projects, then click the + button to the right of Your Projects:

On this page, you can enter a name, choose codebase under Where is your repository hosted, and click Create Project:

You will then be taken to your aTech Identity page, where you will need to allow DeployHQ access to your aTech Media account:

Click Allow Access.


  Now set up a profile for your development, testing and live servers. The key field to pay attention to is "Branch to deploy from". This field locks your server to that branch, it will only deploy changes from that branch, and automatic deployments will only be triggered by changes to that branch.