diff --git a/CHANGELOG.md b/CHANGELOG.md index 83a2aeb2..f332efc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/usage.md b/docs/usage.md index 7f37e534..ca9b260b 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -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