Bitbucket Pipelines to Heroku
Hi everyone! With me again to share some experience, though or opinion about technology related with software engineering field. Today, I will share about my experience did Bitbucket Pipelines and deploying to Heroku.
Maybe this article would be the shortest article among the others. Because it’s very simple, but we have this problem in the past!
So, what’s the problem? We have been facing the situation that should use Heroku for our development server. We know for deploying application to Heroku, we should have a remote url to Heroku git itself. It would be no issue when we just do it without have our own repository.
But, on some project, we have multiple team members that did development on same repository. So, ideally the code between our repository and Heroku repository should be always sync. We can solve this issue by push our code twice, first on our repository then Heroku repository or vice versa.
But sometimes we forgot do this and made some confused between team members. And finally, we have solution for this. Since we use Bitbucket for our repository, we can use Bitbucket Pipelines for solving this issue. The idea is we just push it into our repository, and Bitbucket Pipelines will be push our code to Heroku.
For achieve this solution, we should enable Bitbucket Pipelines on our Bitbucket repository. Then,
bitbucket-pipelines.yml should be created on your root project.
This is the example of our deployment code to Heroku for PHP & Golang code:
Very simple right? And, what’s
$HEROKU_APP_NAME means? It is a variables that you can configured it on repository variables setting. If you want to made it secret, this option would be nice for you. And you need more security for the value, you could made it Secured by checked the Secured checklist when adding the variables.
Hope you enjoy it, I’m happy if this article useful for you! Happy automated delivery!