Is this something I can do?
This is possible. It seems that you've succeeded to do #1 and #2 well. But you have to add extra step to push pack the compiled assets. (For your #3)
For details about how to git push you can check this issue. You may need a CMD task at the end of your pipeline to run below script for pushing back the compiled asserts:
For github repo:
git clone https://github.com/xxx/RepoName.git
git config --global user.email xxx@outlook.com
git config --global user.name xxx
copy "somePath/yourAsserts" RepoName
cd RepoName
git add .
git commit -m "Do sth."
git push https://UserName:UserPassword@github.com/xxx/RepoName.git master
For Azure Devops Repo:
Check this similar issue from Shayki Abramczyk. The Url of azure devops repo is a bit different, related document see here.
In addition, also grant Contribute/Contribute to PR
to ProjectName Build Service
user in Repositories permissions since you'll push changes back to master branch in build pipeline.
Is this something I can do?
But this is not recommended... According to your workflow, something changes in master=>build pipeline run=>build pipeline push back the compiled changes=new changes in master branch=>build run...
This is not a good workflow. I'm not familiar with the asserts you mean, but you can consider publishing the asserts to Azure Devops Artifact feed. An Npm package or Universal package feed? Hope all above helps :)