Skip to content
Merged
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
20 changes: 16 additions & 4 deletions install-rust-toolchain/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ inputs:
components:
description: Optional. List of cargo components to install.
required: false

directory:
description: Optional. Relative directory to current in which to perform rustup install. Useful when having
cargo workspace with different rust-toolchain.toml files in the same repo.
required: false
runs:
using: composite
steps:
Expand All @@ -35,28 +38,35 @@ runs:

- name: Read channel from rust-toolchain.toml
id: toolchain-channel
env:
DIR: ${{ inputs.directory || './' }}
uses: SebRollen/toml-action@v1.2.0
with:
file: 'rust-toolchain.toml'
file: '${{ env.DIR }}rust-toolchain.toml'
field: 'toolchain.channel'

- name: Read components from rust-toolchain.toml
id: toolchain-components
env:
DIR: ${{ inputs.directory || './' }}
uses: SebRollen/toml-action@v1.2.0
with:
file: 'rust-toolchain.toml'
file: '${{ env.DIR }}rust-toolchain.toml'
field: 'toolchain.components'

- name: Read targets from rust-toolchain.toml
id: toolchain-targets
env:
DIR: ${{ inputs.directory || './' }}
uses: SebRollen/toml-action@v1.2.0
with:
file: 'rust-toolchain.toml'
file: '${{ env.DIR }}rust-toolchain.toml'
field: 'toolchain.targets'

- name: Install rust toolchain
id: install-rust-toolchain
shell: bash
working-directory: ${{ inputs.directory || './' }}
env:
CHANNEL: ${{ inputs.channel || steps.toolchain-channel.outputs.value }}
run: |
Expand All @@ -70,6 +80,7 @@ runs:
- name: Add components (optional)
if: inputs.components != '' || steps.toolchain-components.outputs.value != ''
shell: bash
working-directory: ${{ inputs.directory || './' }}
env:
COMPONENTS: ${{ inputs.components || steps.toolchain-components.outputs.value }}
run: |
Expand All @@ -82,6 +93,7 @@ runs:
- name: Add targets (optional)
if: inputs.targets != '' || steps.toolchain-targets.outputs.value != ''
shell: bash
working-directory: ${{ inputs.directory || './' }}
env:
TARGETS: ${{ inputs.targets || steps.toolchain-targets.outputs.value }}
run: |
Expand Down
Loading