1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

Add hability to globally set environment variables

Closes #138
This commit is contained in:
Andrey Nering
2019-01-02 12:05:40 -02:00
parent 5572e31fd4
commit aac6c5a1c7
6 changed files with 51 additions and 16 deletions

View File

@@ -1 +1 @@
env.txt
*.txt

View File

@@ -1,10 +1,33 @@
default:
vars:
AMD64: amd64
env:
GOOS: linux
GOARCH: "{{.AMD64}}"
CGO_ENABLED:
sh: echo '0'
cmds:
- echo "GOOS='$GOOS' GOARCH='$GOARCH' CGO_ENABLED='$CGO_ENABLED'" > env.txt
version: '2'
vars:
BAZ:
sh: echo baz
env:
FOO: foo
BAR: bar
BAZ: "{{.BAZ}}"
tasks:
default:
cmds:
- task: local
- task: global
local:
vars:
AMD64: amd64
env:
GOOS: linux
GOARCH: "{{.AMD64}}"
CGO_ENABLED:
sh: echo '0'
cmds:
- echo "GOOS='$GOOS' GOARCH='$GOARCH' CGO_ENABLED='$CGO_ENABLED'" > local.txt
global:
env:
BAR: overriden
cmds:
- echo "FOO='$FOO' BAR='$BAR' BAZ='$BAZ'" > global.txt