https://lab.civicrm.org/extensions/civirules/-/blob/master/README.md has a reference to "SAVE YOUR EXISTING RULES FIRST." I realize that regarded upgrading from 1.x but I'm interested because I ran into a problem upgrading from 2.19 straight to 2.22 and, if possible, would like to back up just the rules before probing further. Is there a way to save / back-up and later restore just the rules?
There is no import/export function as far as I know but.....
your rules will be saved in a few tables:
- civirule_rule will contain your rules
- civirule_rule_action will contain the combination of actions in your rules
- civirule_rule_condition will contain the combination of conditions in your rules
- civirule_rule_log will contain the logs of your executed rules
- civirule_rule_tag will contain the tags of your rules
You can save these tables before you upgrade and then later restore BUT you would have to make sure that you check the ID's of actions and conditions! So to be on the safe side I would save the tables civirule_action and civirule_condition too so you can compare after the upgrade.
Also, be aware that if you have any delayed rules you have to check the civicrm_queue_item table and execute the cron job for delayed rules until there are no more items left BEFORE you upgrade.
Alternatively you can either develop an import/export function yourself or fund a CiviCRM expert to create that function in the CiviRules extension?