Skip to content

GabLeRoux/travis-multiline-env-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Travis-CI multiline env variables example

Build Status

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. ✌️

The solution

As described in travis-ci#7715, we can replace end lines by \n and wrap the environment variable in settings with "$(echo -e ' and ')".

Example:

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>')"

Confirmed working here

About

📚Convert mutli line environment variable to file with Travis-ci in project settings

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published