1

I am fiddling with heroku to deploy my nodejs based application. The problem is I want to run some pre deployment scripts which contain grunt tasks. These tasks basically minify css and js files and perform some more operations like updating the version of the application in files etc.

The only way that I can think of now is to commit the minified files in the git repo itself and deploy. This is not a good idea (for me at least) as it unnecessarily maintains revision history of minified files which is a total waste.

Please help.

tusharmath
  • 10,622
  • 12
  • 56
  • 83
  • possible duplicate of http://stackoverflow.com/questions/11175923/heroku-github-deployment-strategies?rq=1 – mpm Apr 10 '13 at 18:11
  • possible duplicate of http://stackoverflow.com/questions/13784600/how-to-deploy-node-app-that-uses-grunt-to-heroku – Shyam K Sep 25 '13 at 15:43

1 Answers1

0

I've seen people recommending creating a throwaway git branch for deployments. In the second of the above comments: How to deploy node app that uses grunt to heroku.

Personally I prefer to execute a grunt task(s) that packages my app and copies it to a directory outside my source tree/repo. Usually the target directory contains a throwaway git repository that I add to just to be able to do the push to heroku.

My workflow is to do any file processing I need to and then to copy the results to the output directory, skipping unnecessary files, and adding environment specific configurations and artifacts. A series of grunt tasks does this and the final one adds everything to the local reopo, sets the heroku remote (I have several apps on heroku to cover production, staging, and a sandbox usually used to look at old versions of things), and finally doing the push.

Community
  • 1
  • 1
Robert Moskal
  • 21,737
  • 8
  • 62
  • 86