I have not found an easy way to save and restore and save cache only under certain conditions.
I’d like to achieve the following:
- When build runs on master: don’t restore the cache but save the compiled files to cache
- When build runs on branch: restore cache but don’t save compiled files
This guarantees quick builds on branches but also cleans cache for master builds.
In order for this to work there must be some kind of condition for steps:
- restore_cache: key: deps condition: $CIRCLE_BRANCH != "master"
Or is there a better way?