Cache: Cache single file

Created on 1 Nov 2019  路  2Comments  路  Source: actions/cache

I'm trying to cache the result of docker save, which creates a tar file.
When I try to cache a single file, an error is raised.

- name: Cache docker layers
  uses: actions/cache@preview
  id: cache
  with:
    path: docker_cache.tar
    key: ${{ runner.os }}-docker
/bin/tar -cz -f /home/runner/work/_temp/9d43813f-9c7b-4799-ac7d-f8d0749e7d8c/cache.tgz -C /home/runner/work/<repo>/<repo>/docker_cache.tar .
3
/bin/tar: /home/runner/work/<repo>/<repo>/docker_cache.tar: Cannot open: Not a directory
4
/bin/tar: Error is not recoverable: exiting now
5
##[warning]The process '/bin/tar' failed with exit code 2

I could create a directory just to hold the tar file, but it would be nice if this actions supports caching single files.

enhancement

Most helpful comment

:wave: With the changes to support glob patterns and multiple paths (https://github.com/actions/cache/pull/212), single file caches are now supported.

This is currently available in the default branch (-uses: actions/cache@master) and we'll be pushing a v2 tag next week, see #323 for details.

All 2 comments

There seems to be a bug related to this: https://github.com/actions/cache/issues/144

:wave: With the changes to support glob patterns and multiple paths (https://github.com/actions/cache/pull/212), single file caches are now supported.

This is currently available in the default branch (-uses: actions/cache@master) and we'll be pushing a v2 tag next week, see #323 for details.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

binhxn picture binhxn  路  3Comments

Cerberus picture Cerberus  路  5Comments

binkley picture binkley  路  4Comments

hugovk picture hugovk  路  6Comments

gladhorn picture gladhorn  路  4Comments