I am deploying my first Laravel application with Laravel forge on Digital Ocean, hooked into my Git Repository. While scouring the net for deployment script suggestions, I found one that was simple and seemed to suit my needs. I ran it and realized there is a flaw in my understanding of deployment and was hoping for some tips.
In my script, I am running npm run production, in order to produce the production css and js assets. The flaw I realized is that on my next deploy, I get Git errors because app.js and app.css have changed. I can ssh in and fix those issues but that seems to defeat the purpose. Im curious how others deal with this kind of issue, do you commit the production version each time, or is there some other method? I thought I could gitignore those files but they are already in my repository, and my previous attempts to remove files afterwards created some headaches.
Any tips would be greatly appreciated, or any deployment scripts working well for you.
I usually run npm run production on my local environment and ship the built versions to the production once I am done and ready to deploy, I am also versioning the files for caching purposes. I first use npm run dev or watch for development.
Btw, you can always add to .gitignore you can remove cached files from git using git rm -r --cached file_name .. and it will be ignored from the commit :)