I needed to generate a file based on an environment variable which contains multiple lines. Note: gitlab-ci
does support this out of the boxs. I just needed to do the same with Travis. ✌️
As described in travis-ci#7715, we can replace end lines by \n
and wrap the environment variable in settings with "$(echo -e '
and ')"
.
Expected content
<?xml version="1.0" encoding="UTF-8"?><root>
<Example id="hello">
<Test />
</Example>
</root>
The above content with endlines replaced:
<?xml version="1.0" encoding="UTF-8"?><root>\n <Example id="hello">\n <Test />\n </Example>\n</root>
What we actually need to add in Travis environment variables settings:
"$(echo -e '<?xml version="1.0" encoding="UTF-8"?><root>\n <Example id="hello">\n <Test />\n </Example>\n</root>')"