Hi! I’m trying to use a script to cache a string to a file, and then read that string on a subsequent build. I’ve downloaded my cache and confirmed that I am successfully writing my value to a file by doing the following:
last_deployed_commit_path="$BITRISE_CACHE_DIR/last-deployed-commit"
echo "$GIT_CLONE_COMMIT_HASH" > "$last_deployed_commit_path"
But when I run my workflow again, and try to read my saved file, the path in $BITRISE_CACHE_DIR seems to change, and my script can’t find the file at “$BITRISE_CACHE_DIR/last-deployed-commit”.
For example, the $BITRISE_CACHE_DIR that I saved to initially contains the path
/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/cache252802967
But when I try to read $BITRISE_CACHE_DIR on a subsequent build, the path is now
/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/cache760449913
…and my “last-deployed-commit” file is nowhere to be found.
Am I misunderstanding something? These are scheduled builds (which I’ve been triggering manually to test), and this concerns a single workflow on a single branch. Any help would be much appreciated! Ultimately, I simply want to cache a string when my workflow is run, and have access to that string the next time that same workflow is run. Thanks!