26 lines
675 B
YAML
26 lines
675 B
YAML
name: Cache Files
|
|
desciption: Compress and cache files for later
|
|
|
|
inputs:
|
|
key:
|
|
required: true
|
|
type: string
|
|
default: default
|
|
pattern:
|
|
required: true
|
|
type: string
|
|
|
|
runs:
|
|
using: composite
|
|
container:
|
|
image: alpine
|
|
volumes:
|
|
- /mnt/swarm/gitea/runner/cache:/cache
|
|
steps:
|
|
- run: |
|
|
tar -czf "archive.tar.gz" ${{ inputs.pattern }}
|
|
mkdir -p "/cache/$GITHUB_REPOSITORY/${{ inputs.key }}"
|
|
ARCHIVE="/cache/$GITHUB_REPOSITORY/${{ inputs.key }}/archive.tar.gz"
|
|
[[ ! -f "$ARCHIVE" || "$(md5sum "$ARCHIVE")" != "$(md5sum archive.tar.gz)" ]] && mv archive.tar.gz "$ARCHIVE"
|
|
echo "Created cache: $ARCHIVE"
|