actions/cache/action.yaml

26 lines
668 B
YAML
Raw Normal View History

2023-08-06 22:48:01 -04:00
name: Cache Files
desciption: Compress and cache files for later
2023-08-06 22:16:31 -04:00
inputs:
key:
required: true
type: string
default: default
pattern:
required: true
type: string
runs:
using: composite
container:
image: alpine
volumes:
2023-08-06 22:56:45 -04:00
- /mnt/cache:/mnt/cache
2023-08-06 22:16:31 -04:00
steps:
- run: |
2023-08-06 22:20:33 -04:00
tar -czf "archive.tar.gz" ${{ inputs.pattern }}
2023-08-06 22:56:45 -04:00
mkdir -p "/mnt/cache/$GITHUB_REPOSITORY/${{ inputs.key }}"
ARCHIVE="/mnt/cache/$GITHUB_REPOSITORY/${{ inputs.key }}/archive.tar.gz"
2023-08-06 22:44:19 -04:00
[[ ! -f "$ARCHIVE" || "$(md5sum "$ARCHIVE")" != "$(md5sum archive.tar.gz)" ]] && mv archive.tar.gz "$ARCHIVE"
2023-08-06 22:58:10 -04:00
echo "Created cache: $ARCHIVE"