mirror of
https://github.com/dtolnay/rust-toolchain.git
synced 2024-11-14 05:26:34 +02:00
Add an output intended for cache keys
This commit is contained in:
parent
18ca32f8dc
commit
378ab83624
2 changed files with 12 additions and 2 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -32,4 +32,6 @@ jobs:
|
||||||
toolchain: ${{matrix.rust}}
|
toolchain: ${{matrix.rust}}
|
||||||
- name: Check ${{'${{steps.toolchain.outputs.version}}'}}
|
- name: Check ${{'${{steps.toolchain.outputs.version}}'}}
|
||||||
run: echo '${{steps.toolchain.outputs.version}}'
|
run: echo '${{steps.toolchain.outputs.version}}'
|
||||||
|
- name: Check ${{'${{steps.toolchain.outputs.cachekey}}'}}
|
||||||
|
run: echo '${{steps.toolchain.outputs.cachekey}}'
|
||||||
- run: rustc --version
|
- run: rustc --version
|
||||||
|
|
12
action.yml
12
action.yml
|
@ -17,8 +17,11 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
cachekey:
|
||||||
|
description: A short hash of the rustc version, appropriate for use as a cache key. "20220627a831"
|
||||||
|
value: ${{steps.rustc-version.outputs.cachekey}}
|
||||||
version:
|
version:
|
||||||
description: Version as reported by `rustc --version`, e.g. "rustc 1.62.0 (a8314ef7d 2022-06-27)"
|
description: Version as reported by `rustc --version`. "rustc 1.62.0 (a8314ef7d 2022-06-27)"
|
||||||
value: ${{steps.rustc-version.outputs.version}}
|
value: ${{steps.rustc-version.outputs.version}}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
|
@ -48,7 +51,12 @@ runs:
|
||||||
- run: rustup default ${{inputs.toolchain}}
|
- run: rustup default ${{inputs.toolchain}}
|
||||||
shell: bash
|
shell: bash
|
||||||
- id: rustc-version
|
- id: rustc-version
|
||||||
run: echo "::set-output name=version::$(rustc --version)"
|
run: |
|
||||||
|
: set outputs
|
||||||
|
DATE=$(rustc --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 --version --verbose | sed -ne 's/^commit-hash: //p')
|
||||||
|
echo "::set-output name=cachekey::$(echo $DATE$HASH | head -c12)"
|
||||||
|
echo "::set-output name=version::$(rustc --version)"
|
||||||
shell: bash
|
shell: bash
|
||||||
- run: rustc --version --verbose
|
- run: rustc --version --verbose
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
Loading…
Reference in a new issue