I don't know of any guidance but I think your idea is correct: strive to raise the abstraction level of the build script, make it declarative, and hide the lower-level, boring, imperative stuff in the build logic.
The tradeoff that I see is that while splitting things this way enables you to simplify the build script and/or make it more powerful, at the same time you will probably make the build logic more complicated and more difficult to understand.