Update README with Rust-only examples

This commit is contained in:
2026-05-16 14:02:38 +08:00
parent 48e43c2ed3
commit d5b194bf00
+11 -28
View File
@@ -35,28 +35,10 @@ jobs:
- run: echo "Cache restored, proceeding with build..." - run: echo "Cache restored, proceeding with build..."
``` ```
### With Custom Key File ### Rust Example
```yaml ```yaml
name: Build with Cache name: Rust Build
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Actions/Cache@main
with:
key-file: 'package-lock.json'
- run: npm ci
- run: npm run build
```
### .NET Example
```yaml
name: .NET Build
on: push on: push
defaults: defaults:
@@ -70,16 +52,15 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: Actions/Cache@main - uses: Actions/Cache@main
with: with:
key-file: '**/*.csproj' key-file: 'Cargo.lock'
path: | path: |
~/.cache/ ~/.cache/
~/.nuget/packages ~/.cargo/registry
~/.cargo/git
target
- name: Build - name: Build
working-directory: src/
run: | run: |
dotnet restore cargo build --release
dotnet build --no-restore -c Release
dotnet publish --no-build -c Release
``` ```
### Skip Steps on Cache Hit ### Skip Steps on Cache Hit
@@ -96,10 +77,12 @@ jobs:
- uses: Actions/Cache@main - uses: Actions/Cache@main
id: cache id: cache
with: with:
key-file: 'requirements.txt' key-file: 'Cargo.lock'
- name: Install dependencies - name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
run: pip install -r requirements.txt run: cargo fetch
- name: Build
run: cargo build --release
``` ```
## How It Works ## How It Works