Can I replace a file through the YML file after a build has been completed?

I have two stages in the release cycle – development and production. I want to create a YML file that, on success, will replace the environments file in the code and then compile the code.