Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an output intended for cache keys #21

Merged
merged 1 commit into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ jobs:
toolchain: ${{matrix.rust}}
- name: Check ${{'${{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
12 changes: 10 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ inputs:
required: false

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:
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}}

runs:
Expand Down Expand Up @@ -48,7 +51,12 @@ runs:
- run: rustup default ${{inputs.toolchain}}
shell: bash
- 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
- run: rustc --version --verbose
shell: bash