@@ -55,6 +55,9 @@ You can optionally pass parameters to the action as follows:
5555 workspace-copy : false
5656 # Use native dev drive support when available. Defaults to true.
5757 native-dev-drive : true
58+ # Custom mappings of output environment variables. Defaults to no mapping.
59+ env-mapping : |
60+ MY_PROJECT_BIN,{{ DEV_DRIVE }}/path/to/bin
5861` ` `
5962
6063This action is [compatible](#runner-compatibility) with ` windows-2022` runners or above.
@@ -158,6 +161,59 @@ This action will automatically use the built-in [Windows Dev Drive](https://lear
158161on your behalf when it's available on your Windows runner and `ReFS` is used.
159162You can use this option to turn this automatic usage off.
160163
164+
165+ # ## *env-mapping*
166+
167+ By default, this option is not set.
168+
169+ This option provides syntactic sugar to manage the environment variables exposed by this action.
170+
171+ On a particular job, it can be repetitive having to re-declare the environment variables like below.
172+
173+ ` ` ` yaml
174+ - uses: samypr100/setup-dev-drive@v3
175+ - name: Step A
176+ env:
177+ CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
178+ RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
179+ run: ...
180+ - name: Step B
181+ env:
182+ CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
183+ RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
184+ run: ...
185+ - name: Step C
186+ env:
187+ CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
188+ RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
189+ run: ...
190+ # ...
191+ ` ` `
192+
193+ This option allows you to define them once per job as shown in the example below.
194+
195+ It leverages [handlebars](https://handlebarsjs.com/) syntax under the hood to expose the supported
196+ [environment variables](#environment-variables), giving you the ability to create new ones with
197+ their contents after the action runs, so they can be automatically set in subsequent steps.
198+
199+ **Warning**: No canonicalization is performed on the input. The template is substituted as-is with the
200+ typical values of the environment variables and the rest of the input is then appended as-is.
201+
202+ ` ` ` yaml
203+ - uses: samypr100/setup-dev-drive@v3
204+ with:
205+ env-mapping: |
206+ CARGO_HOME,{{ DEV_DRIVE }}/.cargo
207+ RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup
208+ - name: Step A
209+ run: ...
210+ - name: Step B
211+ run: ...
212+ - name: Step C
213+ run: ...
214+ # ...
215+ ` ` `
216+
161217# # Environment Variables
162218
163219These environment variables are meant to be used along `working-directory` to make sure
0 commit comments