title: How to invoke pre/post deployment scripts during Heroku pipeline promotions
body: <p>I have a rails app that runs database migrations in a rake task after tests have succeeded and immediately before deploying code to Heroku. </p>
  
  <p>I am using <a href="https://elements.heroku.com/addons/codeship" rel="nofollow noreferrer">CodeShip</a> to run the tests, run the migrations, and then finally deploy to heroku. </p>
  
  <p>However, I am running into a problem with Heroku's new <a href="https://devcenter.heroku.com/articles/pipelines" rel="nofollow noreferrer">Pipelines</a> feature.</p>
  
  <p>Upon promoting a version of my app from one environment to another, only the the <a href="https://devcenter.heroku.com/articles/slug-compiler" rel="nofollow noreferrer">application slug</a> is copied over to the new environment. No branches are merged or updated in git, and no codeship builds trigger.</p>
  
  <p>Even the heroku build history shows only a promotion entry with no build log associated. Which makes sense since it is just copying the slug over, not building a new slug. </p>
  
  <p><a href="https://i.stack.imgur.com/Mg4XX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mg4XX.png" alt="enter image description here"></a></p>
  
  <p>So my problem is that when I promote my app to a new environment, I am not able to find any way of hooking a custom script into that event to perform database migrations. </p>
  
  <p><strong>Main Question</strong></p>
  
  <p>Is there support for this that I am just having trouble finding? If not, is a feature in the works that would support this?</p>
  
  <p><strong>Feature Suggestion</strong></p>
  
  <p>Ideally I would like the promotion feature to work by merging the underlying git branches, that way codeship could still kick off, run all tests and migrations again in the new environment, and then finally trigger the build in the next environment. <em>This would require each environment in the pipeline to be tied to a specific branch, instead of just promoting by commit hash, but I don't think that would be problematic.</em></p>
  
  <p>Essentially I would like the promote button to just do what we developers would often do when manually promoting a version of our app, merge to a git branch associated with that environment and let our CI server's git hooks kick it off from there. </p>