diff --git a/install-rust-toolchain/action.yml b/install-rust-toolchain/action.yml index a7409bc..beac51c 100644 --- a/install-rust-toolchain/action.yml +++ b/install-rust-toolchain/action.yml @@ -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: @@ -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: | @@ -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: | @@ -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: |