ci(semver-checks): avoid stale caches after rustc or tool upgrade

With an upgrade to the Rust toolchain, the version of the rustdoc JSON may change. We incorporate the rustc version into the cache key to automatically invalidate the cache in that case. Additionally, we also incorporate the version of the `cargo semver-checks` tool.

Related: https://github.com/obi1kenobi/cargo-semver-checks/issues/415.

Pull-Request: #3664.
This commit is contained in:
Thomas Eizinger 2023-03-24 16:08:56 +01:00 committed by GitHub
parent 7e9581c4ef
commit 82e38bfa28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,10 +17,15 @@ runs:
MAX_STABLE_VERSION=$(curl https://crates.io/api/v1/crates/${{ inputs.crate }} --silent | jq '.crate.max_stable_version')
echo "version=${MAX_STABLE_VERSION}" >> $GITHUB_OUTPUT
- shell: bash
run: |
rustc --version | tee .rustc-version
cargo semver-checks --version | tee .semver-checks-version
- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/target/semver-checks/cache
key: semver-checks-cache-${{ inputs.crate }}-${{ steps.get-released-version.outputs.version }}
key: semver-checks-cache-${{ hashFiles('.rustc-version') }}-${{ hashFiles('.semver-checks-version') }}-${{ inputs.crate }}-${{ steps.get-released-version.outputs.version }}
- run: cargo semver-checks check-release --package ${{ inputs.crate }} --verbose
shell: bash