Basically, all you have to do is to provide a custom module that implements hook_update_N
, and everytime you want your features to be reverted, you add a new hook_update_N
to your module time by time.
Starting with hook_update_7001
, then hook_update_7002
, then hook_update_7003
etc. (presuming you are using D7).
On your live server then you have to run drush updatedb
, it will check for the newest update functions and run the code that's put inside them.
And then there's this question which already has a lot of answers to show you what to put inside your update function to revert a feature programmatically (skip the Drush answer).
How you set up your deploy routine then, that's totally up to you. Normally you would have a webhook or some continuous integration SaaS like CircleCi setup to run a predefined deployment script on every code release automatically. This (Bash-)script then would run let's say git pull
, drush cc all
, drush updb -y
, drush fra -y
always automatically.