mirror of
https://github.com/actions-rust-lang/setup-rust-toolchain.git
synced 2024-12-27 09:05:23 +01:00
Better and more verbose version printing and cachekey version.
This commit is contained in:
parent
8ba04cb6f2
commit
29a2385140
2 changed files with 16 additions and 6 deletions
|
@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
* Install rustup if not available in the CI environment. (Linux only)
|
* Install rustup if not available in the CI environment. (Linux only)
|
||||||
The code is taken from this issue: <https://github.com/dtolnay/rust-toolchain/pull/8>
|
The code is taken from this issue: <https://github.com/dtolnay/rust-toolchain/pull/8>
|
||||||
|
* Add rustc version output suitable as a cache key.
|
||||||
|
This is based on <https://github.com/dtolnay/rust-toolchain/pull/20> and <https://github.com/dtolnay/rust-toolchain/pull/17>.
|
||||||
|
|
||||||
## [1.0.1] - 2022-04-20
|
## [1.0.1] - 2022-04-20
|
||||||
|
|
||||||
|
|
20
action.yml
20
action.yml
|
@ -33,6 +33,9 @@ outputs:
|
||||||
rustup-version:
|
rustup-version:
|
||||||
description: "Version as reported by `rustup --version`"
|
description: "Version as reported by `rustup --version`"
|
||||||
value: ${{steps.versions.outputs.rustup-version}}
|
value: ${{steps.versions.outputs.rustup-version}}
|
||||||
|
cachekey:
|
||||||
|
description: A short hash of the rustc version, appropriate for use as a cache key. "20220627a831"
|
||||||
|
value: ${{steps.versions.outputs.cachekey}}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
|
@ -60,15 +63,20 @@ runs:
|
||||||
rustup toolchain install ${{inputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
|
rustup toolchain install ${{inputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
|
||||||
rustup default ${{inputs.toolchain}}
|
rustup default ${{inputs.toolchain}}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Print installed versions
|
- name: Print installed versions
|
||||||
id: versions
|
id: versions
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=rustc-version::$(rustc --version)"
|
echo "::set-output name=rustc-version::$(rustc +${{inputs.toolchain}} --version)"
|
||||||
rustc --version
|
rustc +${{inputs.toolchain}} --version --verbose
|
||||||
echo "::set-output name=cargo-version::$(cargo --version)"
|
echo "::set-output name=cargo-version::$(cargo +${{inputs.toolchain}} --version)"
|
||||||
cargo --version
|
cargo +${{inputs.toolchain}} --version --verbose
|
||||||
echo "::set-output name=rustup-version::$(rustup --version)"
|
echo "::set-output name=rustup-version::$(rustup +${{inputs.toolchain}} --version)"
|
||||||
rustup --version
|
rustup +${{inputs.toolchain}} --version
|
||||||
|
|
||||||
|
DATE=$(rustc +${{inputs.toolchain}} --version --verbose | sed -ne 's/^commit-date: \(20[0-9][0-9]\)-\([01][0-9]\)-\([0-3][0-9]\)$/\1\2\3/p')
|
||||||
|
HASH=$(rustc +${{inputs.toolchain}} --version --verbose | sed -ne 's/^commit-hash: //p')
|
||||||
|
echo "::set-output name=cachekey::$(echo $DATE$HASH | head -c12)"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: "Setup Rust Caching"
|
- name: "Setup Rust Caching"
|
||||||
|
|
Loading…
Reference in a new issue