Skip to content

Commit 5d17da1

Browse files
Added optional directory input to install-rust-toolchain action (#59)
1 parent 032b19a commit 5d17da1

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

install-rust-toolchain/action.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ inputs:
1919
components:
2020
description: Optional. List of cargo components to install.
2121
required: false
22-
22+
directory:
23+
description: Optional. Relative directory to current in which to perform rustup install. Useful when having
24+
cargo workspace with different rust-toolchain.toml files in the same repo.
25+
required: false
2326
runs:
2427
using: composite
2528
steps:
@@ -35,28 +38,35 @@ runs:
3538
3639
- name: Read channel from rust-toolchain.toml
3740
id: toolchain-channel
41+
env:
42+
DIR: ${{ inputs.directory || './' }}
3843
uses: SebRollen/toml-action@v1.2.0
3944
with:
40-
file: 'rust-toolchain.toml'
45+
file: '${{ env.DIR }}rust-toolchain.toml'
4146
field: 'toolchain.channel'
4247

4348
- name: Read components from rust-toolchain.toml
4449
id: toolchain-components
50+
env:
51+
DIR: ${{ inputs.directory || './' }}
4552
uses: SebRollen/toml-action@v1.2.0
4653
with:
47-
file: 'rust-toolchain.toml'
54+
file: '${{ env.DIR }}rust-toolchain.toml'
4855
field: 'toolchain.components'
4956

5057
- name: Read targets from rust-toolchain.toml
5158
id: toolchain-targets
59+
env:
60+
DIR: ${{ inputs.directory || './' }}
5261
uses: SebRollen/toml-action@v1.2.0
5362
with:
54-
file: 'rust-toolchain.toml'
63+
file: '${{ env.DIR }}rust-toolchain.toml'
5564
field: 'toolchain.targets'
5665

5766
- name: Install rust toolchain
5867
id: install-rust-toolchain
5968
shell: bash
69+
working-directory: ${{ inputs.directory || './' }}
6070
env:
6171
CHANNEL: ${{ inputs.channel || steps.toolchain-channel.outputs.value }}
6272
run: |
@@ -70,6 +80,7 @@ runs:
7080
- name: Add components (optional)
7181
if: inputs.components != '' || steps.toolchain-components.outputs.value != ''
7282
shell: bash
83+
working-directory: ${{ inputs.directory || './' }}
7384
env:
7485
COMPONENTS: ${{ inputs.components || steps.toolchain-components.outputs.value }}
7586
run: |
@@ -82,6 +93,7 @@ runs:
8293
- name: Add targets (optional)
8394
if: inputs.targets != '' || steps.toolchain-targets.outputs.value != ''
8495
shell: bash
96+
working-directory: ${{ inputs.directory || './' }}
8597
env:
8698
TARGETS: ${{ inputs.targets || steps.toolchain-targets.outputs.value }}
8799
run: |

0 commit comments

Comments
 (0)