Option to load tempate variables from json file (#98)

This commit is contained in:
Dmitry Bolotin
2020-09-17 01:52:42 +03:00
committed by GitHub
parent 47352c6cca
commit f021aab825
5 changed files with 126 additions and 38 deletions
+30
View File
@@ -186,6 +186,33 @@ Build finished for *{{tpl.app}}* - *{{tpl.env}}*
{{/success}}
```
Example configuration with a custom message template, with extra vars loaded from file (e.g. from previous build steps):
```diff
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ template_vars_file: build_report.json
+ message: >
+ {{#success build.status}}
+ build {{build.number}} succeeded, artefact version = {{tpl.artefact_version}}.
+ {{else}}
+ build {{build.number}} failed. Fix me please.
+ {{/success}}
```
Where `build_report.json` is:
```
{
...
"artefact_version": "0.2.3452"
...
}
```
Example configuration with a custom socks5 URL:
```diff
@@ -215,6 +242,9 @@ message_file
template_vars
: define additional template vars. Example: `var1: hello` can be used within the template as `tpl.var1`
template_vars_file
: load additional template vars from json file. Example: given file content `{"var1":"hello"}`, variable can be used within the template as `tpl.var1`
photo
: local file path