Use the release phase to automate your release in your Laravel app

On Heroku the release phase allows you to run certain tasks before a new release of your app is deployed.

Release phase can be useful for tasks such as:

  • Run the database migrations
  • Clear cache
  • Sending CSS, JS, and other assets from your app’s slug to a CDN or S3 bucket

In our Laravel app, we will run the database migrations and flush the application cache.

Add the following line to your Procfile:

The main advantage of using the release phase:

If the release command exits with a non-zero exit status, or if it’s shut down by the dyno manager, the release fails. In this case, the release is not deployed to the app’s dyno formation. You will receive an email notification in the event of a release phase failure.

Want more tips like these?

You should follow me on Twitter! And if you’re building on Heroku, you should check out AutoIdle — the automated way to save money on your staging and review apps.

We are building a Heroku Add-on that helps you save money by automatically putting your non-critical apps to sleep after a period of inactivity.