A) Is it bad practice to send to Heroku directly the modified files? Should I first commit them to github in special release folder and then send that to heroku? how?
B) Is it just something missing in my yml?
You could do a git commit on CircleCI in the build repo, and then push that to Heroku. Don’t push to GitHub though - these are generated build artefacts and you don’t want them in your central repo, because they just replicate the source files.
That seemed to work, but after the first commit, but now I am getting this:
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master
To https://cred...@git.heroku.com/project.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://cred...@git.heroku.com/project.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Exited with code 1
I also tried to put a -f to my git push, and now I get:
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Exited with code 1
Ah yes, I guess that’s because CircleCI doesn’t just do a git clone in the checkout, it does all sorts of hard reset malarkey (open up the step in the build viewer to see what it does). I guess that because Heroku has an ordinary clone of your project, the new state of the repo at CircleCI is unmergeable.
You could try --force with your push - the remote copy on Heroku is just a throw-away copy anyway.
Thanks for your help, seems much more complicated than expected. I will create the files on Heroku directly with a postinstall script. Thanks for your help though