-
Notifications
You must be signed in to change notification settings - Fork 9
40 lines (34 loc) · 1.45 KB
/
extract-rust-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Find the nightly Rust version and required components in `rust-toolchain.toml` using
# <https://taplo.tamasfe.dev>. The output of this workflow can then be used in
# `@dtolnay/rust-toolchain` to install Rust.
name: Extract Rust Version
on:
workflow_call:
outputs:
channel:
description: The Rustup channel extracted from `rust-toolchain.toml`.
value: ${{ jobs.extract-rust-version.outputs.channel }}
components:
description: A comma-separated list of Rustup components extracted from `rust-toolchain.toml`.
value: ${{ jobs.extract-rust-version.outputs.components }}
jobs:
extract-rust-version:
name: Extract Rust version
runs-on: ubuntu-latest
outputs:
channel: ${{ steps.toolchain.outputs.channel }}
components: ${{ steps.toolchain.outputs.components }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Taplo
run: |
curl -fsSL /~https://github.com/tamasfe/taplo/releases/latest/download/taplo-linux-x86_64.gz \
| gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taplo
- name: Extract toolchain
id: toolchain
run: |
CHANNEL=$(taplo get -f='rust-toolchain.toml' 'toolchain.channel')
COMPONENTS=$(taplo get -f='rust-toolchain.toml' --separator=', ' 'toolchain.components')
echo channel=$CHANNEL >> $GITHUB_OUTPUT
echo components=$COMPONENTS >> $GITHUB_OUTPUT