If you can use the multi-line format of the run step, adding in another line doesn’t seem too onerous. You could even have a quick linter to ensure it is present in every step:
- run:
name: Save Docker image layer cache
command: |
sh /tmp/run-me.sh
mkdir -p /caches
docker save -o /caches/${CIRCLE_PROJECT_REPONAME}.tar ${CIRCLE_PROJECT_REPONAME}
Adding that run-me.sh
manually doesn’t seem to harm readability too much?