Cache usage problem. Force re-caching always

I’m experimenting with using GitHub actions but had no real success so far. I’m using one workflow with three jobs so far. Job 1 builds Linux binaries. Job 2 builds Windows executables. Job 3 depends on Job 1 and 2 and uploads the build artifacts to a nightly build pre-release. Later on this job also needs to build Live binaries composing of both job artifacts.

My problem now is how to hand the artifacts between the jobs. I tried using action/cache to store the artifacts in Job 1 and 2 and then fetch them in Job 3. This worked for the first time but then the Jobs 1 and 2 see the cache existing (in different workflow runs) and do not update it causing problems.

So what can I do? Can I force the caches to be deleted for each and every run of Job 1 and 2? Or is there a better way to hand off artifacts from one build job to the other?

Please, post the relevant parts of your workflow YAML. In particular, the caching steps.

Most likely, the problem is solvable with the correct value of the key input. If it’s static, then the same cache will be reused in every run. You can set it to something that changes between runs, e.g. ${{ github.sha }}, but maybe in your case there is a better option, e.g. depending on source changes.

The cache probably isn’t the right tool for that, artifacts are intended for sharing data between jobs. See the docs here: Passing data between jobs in a workflow