Although the after_build tip is the default answer, I would suggest using a task runner to complete the task.
A task runner is cool to simplify such procedures. For example, most Middleman projects require deployment to a hosting server. Therefore, if you need a runner for deployment, you can use it to copy a file.
If you are not using a task runner, consider using this. This will save you a lot of trouble.
Rake is the natural choice for Middleman Ruby, but I prefer Grunt .
Here's the Grunt copy job (uses the grunt-contrib-copy plugin):
copy: { bowercomponents: { files: [ { expand: true, flatten: true, src: [ 'source/Readme.md' ], dest: 'build/', filter: 'isFile' } ] } }
And here is the deployment task using the grunt-shell plugin:
shell: { buildAndPublish: { command: [ 'echo "### Building ###"', 'bundle exec middleman build --verbose', 'echo "### Adding built files to git index ###"', 'cd build/', 'git add -A', 'echo "### Commiting changes ###"', 'git commit -m build', 'echo "### Pushing the commit to the gh-pages remote branch ###"', 'git push origin gh-pages', 'cd ..' ].join(' && '), options: { stdout: true, stderr: true } } }