File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ Example of `Taskvars.yml` file:
303303` ` ` yml
304304PROJECT_NAME: My Project
305305DEV_MODE: production
306- GIT_COMMIT: $ git log -n 1 --format=%h
306+ GIT_COMMIT: {sh: git log -n 1 --format=%h}
307307` ` `
308308
309309> NOTE: It's also possible setting a variable globally using `set` attribute
@@ -323,20 +323,34 @@ set-message:
323323
324324# ### Dynamic variables
325325
326- If you prefix a variable with `$`, then the variable is considered a dynamic
327- variable. The value after the $-symbol will be treated as a command and the
328- output assigned.
326+ The below syntax (`sh:` prop in a variable) is considered a dynamic
327+ variable. The value will be treated as a command and the output assigned.
329328
330329` ` ` yml
331330build:
332331 cmds:
333- - go build -ldflags="-X main.Version={{.LAST_GIT_COMMIT }}" main.go
332+ - go build -ldflags="-X main.Version={{.GIT_COMMIT }}" main.go
334333 vars:
335- LAST_GIT_COMMIT: $git log -n 1 --format=%h
334+ GIT_COMMIT:
335+ sh: git log -n 1 --format=%h
336336` ` `
337337
338338This works for all types of variables.
339339
340+ > It's also possible to prefix the variable with `$` to have a dynamic
341+ variable, but this is now considered deprecated :
342+
343+ ` ` ` yml
344+ # Taskvars.yml
345+
346+ # recommended
347+ GIT_COMMIT:
348+ sh: git log -n 1 --format=%h
349+
350+ # deprecated
351+ GIT_COMMIT: $git log -n 1 --format=%h
352+ ` ` `
353+
340354# ## Go's template engine
341355
342356Task parse commands as [Go's template engine][gotemplate] before executing
You can’t perform that action at this time.
0 commit comments