Move some functionality from publish() to PluginStep.process_lifecycle()

The functionality that was in publish() is generally useful and should live in
PluginStep.
Merge pull request #1071 from beav/pluginstep-process_lifecycle

Move some functionality from publish() to PluginStep.process_lifecycle()