ci(release): stabilize rust cache keys

This commit is contained in:
t8y2 2026-05-09 23:57:54 +08:00
parent cdb18baa6a
commit 1c53e68269
2 changed files with 12 additions and 4 deletions

View File

@ -38,7 +38,7 @@ jobs:
uses: swatinem/rust-cache@v2
with:
workspaces: './ -> target'
shared-key: release-x86_64-unknown-linux-gnu
shared-key: ci-x86_64-unknown-linux-gnu
- name: Install system dependencies (Linux)
run: |

View File

@ -45,18 +45,26 @@ jobs:
with:
targets: ${{ matrix.target }}
- name: Compute dependency hash (excludes app version from Cargo.lock)
- name: Compute Rust dependency hash
id: deps-hash
shell: bash
run: |
hash=$(grep -v '^version = ' Cargo.lock | sha256sum | cut -d' ' -f1)
echo "hash=${hash:0:20}" >> "$GITHUB_OUTPUT"
{
find . -name Cargo.toml -not -path './target/*' -print0 \
| sort -z \
| xargs -0 sed -E '/^version = /d'
grep -v '^version = ' Cargo.lock
} | sha256sum | cut -d' ' -f1 | {
read -r hash
echo "hash=${hash:0:20}" >> "$GITHUB_OUTPUT"
}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './ -> target'
shared-key: release-${{ matrix.target }}-${{ steps.deps-hash.outputs.hash }}
add-rust-environment-hash-key: false
cache-on-failure: true
- name: Install system dependencies (macOS)