IMHO the ideal approach is placing infrastructure effort as tasks under the user story where it first holds value; as you have mentioned.
Taking your example; manually building and deploying implies it is an ongoing effort and has no form of completion. It exists indefinitely.
The same could be said for code which automates any portion of effort in a typical application which was previously done manually. Defining this effort as a task under a user story defines complete; which by its very nature has value to the end user.
You could certainly build and deploy the application each and every sprint but that then becomes part of the day to day tasks which are not formally tracked via the backlog and then this all becomes moot.