Depending on what you are trying to achieve, you should also look into using the deployment job as it gives you the opportunity to set a preDeploy:
which run steps prior to what you set as deployment. You can also use the on: success
and on: failure
sections to set what will become your post deployment steps.