Deploying to Heroku from Gitlab
code, devops, CI/CD, heroku, gitlab
Having a continues deployment to Heroku from Gitlab is hidden away, previous solutions I've found require putting in docker acrobatics into your .gitlab-ci.yml
and a rest endpoint; but no more! The solution is simple for most projects.
Master is Prod
Leveraging the Gitlab repo mirror tool for only protected branches we can just provide the login for Heroku and we're done! The steps below give more detail:
- Install the Heroku cli
- Generate an access token
- Set up repo mirroring from your project to
http://user@git.heroku.com/your-app.git
- The username is ignored
- The password is your access token
- And were done, pushes to master should mirror into Heroku, build and deploy automagically!