Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy .gitignored compiled files in Heroku?

I have a compiled folder named /target where my server.js lives. Since it's compiled files, I added /target to .gitignore since I don't want all those changes checked it into my GitHub.

But Heroku ignores anything listed in the .gitignore, so I'm unable to spin up the app.

Ideally I'd like to run node /target/scripts/server.js in Heroku. And not have the compiled /target folder checked into GitHub.

What's the best way to handle this situation?

like image 741
Henry Zhu Avatar asked Mar 09 '15 02:03

Henry Zhu


1 Answers

Seems like none answered this question, hope this will help someone :)

Step 1: create a seperate branch for heroku that contains your target folder, say myheroku.

git checkout -b myheroku

Step 2: modify .gitignore by removing target/, run your command lein cljsbuild to generate production files.

git add target/  
git commit -m "your commit message"

Step3: push the branch with target changes to heroku

git push heroku myheroku:master

So, after working & finished testing,

  • checkout your heroku local branch; can generate build files
  • commit & push from localbranch to heroku master as Step3

NOTE: i hope there is no problem for you dealing with that extra commit messages polluting heroku localbranch.

like image 104
Renjith Thankachan Avatar answered Sep 18 '22 11:09

Renjith Thankachan