mirror of
				https://github.com/go-task/task.git
				synced 2025-10-30 23:58:01 +02:00 
			
		
		
		
	Documentation and changelog for global environment variables
This commit is contained in:
		| @@ -5,7 +5,12 @@ | ||||
| - On Windows, Task can now be installed using [Scoop](https://scoop.sh/) | ||||
|   ([#152](https://github.com/go-task/task/pull/152)); | ||||
| - Fixes issue with file/directory globing | ||||
|   ([#153](https://github.com/go-task/task/issues/153)). | ||||
|   ([#153](https://github.com/go-task/task/issues/153)); | ||||
| - Add ability to globally set environment variables | ||||
|   ( | ||||
|     [#138](https://github.com/go-task/task/pull/138), | ||||
|     [#159](https://github.com/go-task/task/pull/159) | ||||
|   ). | ||||
|  | ||||
| ## v2.2.1 - 2018-12-09 | ||||
|  | ||||
|   | ||||
| @@ -31,23 +31,41 @@ interpreter. So you can write sh/bash commands and it will work even on | ||||
| Windows, where `sh` or `bash` are usually not available. Just remember any | ||||
| executable called must be available by the OS or in PATH. | ||||
|  | ||||
| If you ommit a task name, "default" will be assumed. | ||||
| If you omit a task name, "default" will be assumed. | ||||
|  | ||||
| ## Environment | ||||
|  | ||||
| You can specify environment variables that are added when running a command: | ||||
| You can use `env` to set custom environment variables for a specific task: | ||||
|  | ||||
| ```yaml | ||||
| version: '2' | ||||
|  | ||||
| tasks: | ||||
|   build: | ||||
|   greet: | ||||
|     cmds: | ||||
|       - echo $hallo | ||||
|       - echo $GREETING | ||||
|     env: | ||||
|       hallo: welt | ||||
|       GREETING: Hey, there! | ||||
| ``` | ||||
|  | ||||
| Additionally, you can set globally environment variables, that'll be available | ||||
| to all tasks: | ||||
|  | ||||
| ```yaml | ||||
| version: '2' | ||||
|  | ||||
| env: | ||||
|   GREETING: Hey, there! | ||||
|  | ||||
| tasks: | ||||
|   greet: | ||||
|     cmds: | ||||
|       - echo $GREETING | ||||
| ``` | ||||
|  | ||||
| > NOTE: `env` supports expansion and and retrieving output from a shell command | ||||
| > just like variables, as you can see on the [Variables](#variables) section. | ||||
|  | ||||
| ## Operating System specific tasks | ||||
|  | ||||
| If you add a `Taskfile_{{GOOS}}.yml` you can override or amend your Taskfile | ||||
|   | ||||
		Reference in New Issue
	
	Block a user