Add a cargo key and use it to update caches (#2485)

diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml
index 47a8a8a..078b3fc 100644
--- a/.github/actions/cache/action.yml
+++ b/.github/actions/cache/action.yml
@@ -40,9 +40,14 @@
       shell: bash
     - name: Generate cargo cache key
       if: ${{ inputs.use-rust == 'true' }}
-      id: cargo-key
       run: |
-        echo "key=cargo-registry-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ inputs.extra-key }}-${{ hashFiles('.github/action/**', steps.workflow-info.outputs.path, 'CMakeLists.txt', 'cmake/Modules/Findrav1e.cmake', 'cmake/Modules/LocalRav1e.cmake', 'ext/rav1e.cmd') }}" >> "$GITHUB_OUTPUT"
+        echo "CARGO_KEY=cargo-`cargo --version|cut -d' ' -f2`-${{ hashFiles('.github/action/**', steps.workflow-info.outputs.path, 'CMakeLists.txt', 'cmake/Modules/Findrav1e.cmake', 'cmake/Modules/LocalRav1e.cmake', 'ext/rav1e.cmd') }}" >> $GITHUB_ENV
+        echo "CARGO_CACHE_KEY=${{ env.CARGO_KEY }}-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ inputs.extra-key }}" >> $GITHUB_ENV
+      shell: bash
+    - name: Generate empty cargo cache key
+      if: ${{ inputs.use-rust != 'true' }}
+      run: |
+        echo "CARGO_KEY=cargo-none" >> $GITHUB_ENV
       shell: bash
     - name: Cache all of cargo
       if: ${{ inputs.use-rust == 'true' }}
@@ -50,16 +55,16 @@
       continue-on-error: true
       with:
         path: ~/.cargo
-        key: ${{ steps.cargo-key.outputs.key }}-${{ github.run_id }}
-        restore-keys: ${{ steps.cargo-key.outputs.key }}
+        key: ${{ env.CARGO_CACHE_KEY }}-${{ github.run_id }}
+        restore-keys: ${{ env.CARGO_CACHE_KEY }}
     - name: Cache external dependencies in ext
       id: cache-ext
       uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
       with:
         path: ext
-        key: ext-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ inputs.extra-key }}-${{ env.MESON_KEY }}-${{ hashFiles('.github/action/**', steps.workflow-info.outputs.path, 'ext/*.cmd', 'ext/*.sh') }}
+        key: ext-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ inputs.extra-key }}-${{ env.CARGO_KEY }}-${{ env.MESON_KEY }}-${{ hashFiles('.github/action/**', steps.workflow-info.outputs.path, 'ext/*.cmd', 'ext/*.sh') }}
     - name: Cache external dependencies in build/_deps
       uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
       with:
         path: build/_deps
-        key: deps-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ inputs.extra-key }}-${{ env.MESON_KEY }}-${{ hashFiles('.github/action/**', steps.workflow-info.outputs.path, 'CMakeLists.txt', 'cmake/Modules/*') }}
+        key: deps-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ inputs.extra-key }}-${{ env.CARGO_KEY }}-${{ env.MESON_KEY }}-${{ hashFiles('.github/action/**', steps.workflow-info.outputs.path, 'CMakeLists.txt', 'cmake/Modules/*') }}