From 1c53e68269cecdb0c3331a56910fb13c93a3bc71 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Sat, 9 May 2026 23:57:54 +0800 Subject: [PATCH] ci(release): stabilize rust cache keys --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 689cfac4f..6f013cf7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e198f27d..fd48fb00d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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)