Bitbucket Pipelines to Heroku

Pipeline Vectors by Vecteezy

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.

Picture 1 Our code push flow

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.

Picture 2 Our new code push flow

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_API_KEY and $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.

Picture 3 Repository variables on Bitbucket

Hope you enjoy it, I’m happy if this article useful for you! Happy automated delivery!

Thank you!




Software Engineer | Traveler | Guitarist | J-Lovers

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Evolution of Encrypted Credentials in Rails 6.2

Evolution of Encrypted Credentials in Rails 6.2


Big Data and its Various Aspects

Google Tag Manager -> why you should DEFINITELY use it + bonus CXL course review

Why denormalization is the only option sometimes?

Why big software estimates are so hard — and what to do about it

CS373 Spring 2022: Sabeer Shahzad Week 7

TimescaleDB and Django

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bismo Baruno

Bismo Baruno

Software Engineer | Traveler | Guitarist | J-Lovers

More from Medium

Quickly And Efficiently Assessing Application Logs

General planning concerns about servers (2/3)

4 tips to improve your git skills

Is Blue-Green Deployment Strategy just a Hype?