Fix bug: CI didn't check out correct Git branch
This commit fixes a bug in the CI/CD code. Previously, the CI/CD script didn't explicitly check out a branch, so all deployments were from 'master'. This is fixed now and the script section is generalised and moved to the template.