This example shows how persistent variables can effectively be provisioned by saving data to a file in iCloud and reading it back in. It would be great to do this as JSON as this would easily allow multiple variables to be saved in a single file, but until workflow allows you to write back individual keys into a JSON dictionary it's just much easier to store one data item per file.
The workflow begins by attempting to read in a file that is to hold the variable data. If the file exists it will be stored in a variable. If it doesn't the variable is initialised to zero.
The variable is incremented and saved back to the file. The file is created if it does not already exist and overwritten if it does. The workflow output is the incremented value.