0

I have a project repository containing 2 folders: server1 and server2. I want to deploy the contents of server1 to heroku automatically as I commit them to my github repository. I do not have a CI set up currently, but am looking for Travis specific steps.

Kaustubh Badrike
  • 580
  • 2
  • 15

2 Answers2

0

You could follow the steps described in "Heroku Deployment"

Travis CI can automatically deploy your Heroku application after a successful build.

deploy:
  provider: heroku
  api_key: ...
  app: my-app-123

In your case, you would:

See "Can I use Git submodules to keep a copy of one branch inside a directory of another branch in the same repository?"

That way:

  • TravisCI can deploy server2 content, since it is a branch
  • you can work in server2 subfolder in your master branch, since server2 subfolder is the root folder of a submodule, which would reference the content of the server2 branch!

Again: that involves re-organizing your repository, in order to isolate the content of server2 folder in its own branch, and reference that branch as a submodule, stored in the path server2/ in your master branch.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Submodules seemed complex, so I dug around for a bit and settled on changing the document root in my procfile, but that's created some issues of its own. Thanks for the info. – Kaustubh Badrike Feb 26 '19 at 15:56
  • @KaustubhBadrike No problem. Submodule should be trivial to implement here: https://stackoverflow.com/a/51166069/6309 include the relevant commands. – VonC Feb 26 '19 at 17:16
0

Just in case someone else is struggling, this fixed it for me, in the parent directory have your travis.yml In your travis.yml add before_install: cd (your folder, like frontend)

For example :

language: node_js
node_js:
- node
before_install: cd Web
install: ...

I also had a Procfile in my front end folder with ProjectName: node server.js

Joe_K
  • 1
  • 2
  • 3