How to hotfix

This is only required for backend deployment. For the frontend, you can simply promote any build to production from the Netlify dashboard.

Our Continuous Integration (CI) works on the basis of trunk-based development which means that the master branch in GitHub always holds the version that will go into production next. So, the CI server only performs a full production build when you push to master and automatically deploys this to your staging environment.

There might be cases where you can't simply deploy the latest master build to production. For example, you're currently testing a big new feature that isn't ready to go live yet, but you need to deploy an urgent fix to production. To do this, follow the steps below.

Releasing a hot-fix

  1. Find out which version is currently deployed to your backend production system (open the studio, click Developer, then Deployment)

13ed2aa Deployment version number

In this example, it's version 2022. Every such version corresponds to a certain commit and tag in your GitHub repository. So, you can easily use it as a starting point for a branch for your fix.

  1. Create a branch for your fix from the backend production version:
git checkout -b fix/something-urgent 2022.

This creates a branch named fix/something-urgent that starts precisely at the point deployed in production.

  1. Apply your fix, test it properly, and push the branch to the remote repository using:
git push -u origin fix/something-urgent

This will cause the CI server to perform centralized tests on this branch.

This won't build production-ready assets yet. To do this, you'll need to explicitly instruct the CI server by pushing a commit that includes #build (see the Continuous Integration article for more information.

  1. Push a commit including #build
git commit -m 'ci: #build' --allow-empty ; git push

This command creates an empty commit with just the corresponding message in your branch and pushes it to the remote.

Once the CI server has finished the build successfully, you'll find a new tag in your branch that you can use to trigger a deployment.

  1. Deploy your new tag to staging from the Development section in the studio (see the rollout section of the deployment article for the steps to do this)

  2. Test the fix in staging

  3. Roll back to the previous staging version

  4. Roll out your fix to production from the studio

  5. Merge your fix into master so it's not lost when you deploy again