There is actually a feature already in Studio that does this, but its super dumb.
You can set a rule to enforce a commit on publish, but it is pretty worthless as it enforces the commit BEFORE publish, as in before you wrote your commit message and updated the version, as a result sometimes the build fails but whats worse is your project.json is committed with the old version number and you are left with an uncommitted change as it now has a new version post commit meaning you need to commit again… really stupid.
Pipelines are an alternative, but thats a publish on commit, not commit on publish and people still can commit without publishing unless you remove their permissions to do so.
If you do explore pipelines you’ll need to also use branching since you likely don’t want a publish on every single commit, UiPath build pipelines integrate well with Github meaning you don’t have to try to learn Jenkins, so perhaps also look at that.