In this post, I'm going to go over the steps to create your own custom module workflow plugin. For this example let's consider the following to be our requirements:
The Workflow has 5 states - Draft, Needs Review, Approved, Published, Unpublished
There are 5 events or "transitions" - Submit for review, Approve, Request updates, Publish, Unpublish
Only certain roles can approve/publish/unpublish content
Some custom code needs to be executed when the node is moved into the "Approved" state