How to save repositories for deployment for Heroku as part of developing Git repos and save them separately?

I have a git repository that I used to develop my application, and now I want to deploy it to Heroku. However, I do not want to deploy this repo itself, but rather build code in this repo. My build system creates a dist directory in my repo directory, which contains everything you need to deploy anywhere. It is configured to be ignored in .gitignore because it does not need to be stored, as it can be rebuilt at any time and will be redundant. However, Heroku needs a git repo to deploy. I could manually copy the output in dist to another repo, which I only support for Heroku, but that seems really ugly. I want to be able to develop source code, create deployment code and click the first on GitHub / Lab, and the second on Heroku without overlapping.

I would like something like this: My dist folder is my own git repository to satisfy Heroku, which is not included in the rep-repo parent history, that is, when I push my dev repo to GitHub or GitLab, the dist folder is ignored. When I click the contents of dist on Heroku, he does not know that it is contained in the development project. That way, my build process automatically changes my deployment repository, which I can commit when necessary to mark deployment events.

I am not sure how to set it up, if possible. I have heard terrible things about submodules, and I'm not even sure if this is the right tool for the job, as it seems to be more related to the inclusion of other external repos in mine. Here I want to create repos that live only in my parent repo.

If there are others with a similar setting who know something better than what I requested, I am open to ideas.

+4
source share
1 answer

I would create another branch named 'dist':

 git checkout -b 'dist' 

And inside this branch I would modify the gitignore file so that the dist folder is added.

Then I pushed my dist branch to heroku like this:

 git push heroku dist:master 

Does this work for you?

+4
source

Source: https://habr.com/ru/post/1496531/


All Articles