Fix order of before and after hooks.

Also fix passing arguments to tasks executed by before and after hooks.
Create release as part of publishing.