Search code examples
amazon-web-servicesaws-code-deploy

Deploying a specific branch using AWS CodeDeploy


I have followed this guide:

https://blogs.aws.amazon.com/application-management/post/Tx33XKAKURCCW83/Automatically-Deploy-from-GitHub-Using-AWS-CodeDeploy

It mentions that it will push the default branch from GitHub.

What about all the other branches one might have in the same repo?

Can I somehow specify which branch to deploy?


Solution

  • After scratching and cursing and researching and out of the box thinking...I managed to do it like this.

    As long as CodeDeploy plays nicely only with the default branch, let's manipulate that one from the GitHUb API [you can do it also from the settings of the GH UI].

    This is the code to change/update the default branch from your repo.

    I have confirmed that CodeDeploy had no problem deploying the new branch! :]