Automated branch deployments with Zeit 2.0 & CircleCI

Sebastian Schlecht
Feb 1, 2020 · 4 min read
Image for post
Image for post

At Capmo we are continuously searching for new ways to improve our product development process to be more agile, inclusive and to support different work modes, sync as well as async. This article describes how we tackled a particular problem we encountered as soon as we had more than one person on the team working on our web application — the problem of design and product management not being able to give feedback on multiple increments being worked on in parallel early in the process when having a limited amount of environments to deploy to.

Our starting point

Zooming in on the problem

Branch deployments for the rescue

Image for post
Image for post
Our webapp CI workflow

Within our CI we then configured a job, which simply runs on all branches except master to create a new Github deployment, compute a dynamic subdomain based on the branch name and an alias. Such a domain could look like whereas one needs to configure a wildcard CNAME entry for dynamic subdomains (*

To create a new deployment inside Github, use the following snippet. Please note that we run on CircleCI, so some constants might not be available when using a different CI. The following gist illustrates parts of our workflow.

Dynamic deployments can be done only with a few lines of code

Well, that’s it actually. It’s really simple and easy to do, comes with almost zero additional costs and enables a variety of process improvements since designers, PMs or testers can access new increments as they are actively being built in an async manner, before pull requests are merged. To make things more accessible for the rest of the team, we use Github’s API to create deployments for each PR, linking the newly created environment directly to each pull request.

Ultimately, we are quite happy with the approach, integration took only a couple of hours (less if we would have had a guide) and it still runs as part of our daily business at no additional cost providing fast and early feedback loops to improve on quality later in the process. We strongly believe that this increases overall speed/quality ratio and allows us to deliver high quality in a shorter amount of time.

Side note — branch deployments can also be used for some last minute validations or testing before things are being shipped as they are shareable with people outside the product team as well.

Stay tuned for more articles on closing the gap between engineering, design and product management. We are currently building the same workflow for our mobile application, aiming at a similar experience as compared to our web application.

Capmo Stories

Learnings from building a leading B2B SaaS business in…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store