Update README with accurate single-path usage examples
This commit is contained in:
@@ -7,9 +7,9 @@ A Gitea Action that caches build files as `tar.xz` archives on the runner filesy
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `path` | Directory to cache | No | `~/.cache/` |
|
||||
| `path` | Single directory to cache | No | `~/.cache/` |
|
||||
| `key-prefix` | Prefix for the cache key | Yes | — |
|
||||
| `key-file` | File to hash for the cache key | Yes | — |
|
||||
| `key-file` | File to hash (SHA-256) for the cache key | Yes | — |
|
||||
|
||||
## Outputs
|
||||
|
||||
@@ -19,9 +19,9 @@ A Gitea Action that caches build files as `tar.xz` archives on the runner filesy
|
||||
|
||||
## How It Works
|
||||
|
||||
1. Hashes `key-file` with SHA-256, combines with `key-prefix` as the cache key
|
||||
1. Hashes `key-file` with SHA-256, combines with `key-prefix` as `<prefix>-<hash>`
|
||||
2. Stores archives at `~/.cache/.cache-store/<key>.tar.xz`
|
||||
3. Restores by extracting the archive, saves by creating one
|
||||
3. Restores by extracting the archive to `/`, saves by creating one
|
||||
|
||||
## Rust Example
|
||||
|
||||
@@ -40,12 +40,9 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Actions/Cache@main
|
||||
with:
|
||||
key-prefix: 'rust'
|
||||
key-prefix: 'cargo-registry'
|
||||
key-file: 'Cargo.lock'
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
path: '~/.cargo/registry'
|
||||
- name: Build
|
||||
run: cargo build --release
|
||||
```
|
||||
@@ -56,6 +53,10 @@ jobs:
|
||||
name: Build with Conditional Steps
|
||||
on: push
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -66,6 +67,7 @@ jobs:
|
||||
with:
|
||||
key-prefix: 'rust'
|
||||
key-file: 'Cargo.lock'
|
||||
path: '~/.cargo/registry'
|
||||
- name: Fetch dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: cargo fetch
|
||||
|
||||
Reference in New Issue
Block a user