I am setting up a CI process using GitLab and SFDX. Developers do their work in a scratch org, then commit their changes to a QA branch. Upon this commit, the CI pipeline then deploys the entire source (force-app/) to a QA sandbox. We are not currently using unlocked packages.
Instead of deploying the entire source each time, how would it be possible to only deploy the files changed in the latest commit?
I'm thinking something along the lines of using the git diff-tree
command to build a list of the changed files, moving these files to a separate directory, using this directory in the sfdx force:source:deploy
command, and then deleting the directory. But how to pull this off through a CI pipline, I'm stumped.