fix(ci): build master branch with clean cache
CI on master branch always reuses the same archive. As a result, its size gradually grows. It already takes more than 6GB, while it should be about 3GB large. It makes restoring the cache slower and slower.
With this patch the cache is cleared every time in master branch.
Another problem is that concurrent jobs on a dev branch sometimes fail with the error: "tar: Unexpected EOF in archive". The reason is that saving cache instantaneous and usually takes about a minute, disrupting other jobs.
Now tar writes to a different filename with a random suffix, and then renames it atomically.
Edited by Yaroslav Dynnikov