AkhileshNS / heroku-deploy

A simple github action that dynamically deploys an app to heroku

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I run a command on Heroku after deployment

vedmant opened this issue · comments

In my case I'm deploying Laravel application, and I need to run php artisan optimize to optimize Laravel after deployment.
How I can do this?

in your composer.json file add a script

"scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "warmup": [
            "@php artisan optimize",
        ]
    }

and then in your Procfile call it

web: composer run-script warmup && vendor/bin/heroku-php-apache2 public/