diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b7cebda..29f873e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,7 +33,8 @@ jobs: /home/runner/work/attendance/attendance/src-api/target ~/.cargo/registry ~/.cargo/git - key: ${{ runner.os }}-rust-cache + key: ${{ runner.os }}-rust-cache-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-rust-cache - name: Set up Rust uses: actions-rs/toolchain@v1 @@ -89,11 +90,11 @@ jobs: --allow-unauthenticated - name: Save target cache - if: always() && steps.cache-restore.outputs.cache-hit != 'true' + if: always() && (steps.cache-restore.outputs.cache-hit != 'true' || steps.cache-restore.outputs.cache-primary-key == '${{ runner.os }}-rust-cache') uses: actions/cache/save@v4 with: path: | /home/runner/work/attendance/attendance/src-api/target ~/.cargo/registry ~/.cargo/git - key: ${{ steps.cache-restore.outputs.cache-primary-key }} + key: ${{ runner.os }}-rust-cache-${{ hashFiles('**/Cargo.lock') }}