Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gableroux/travis-multiline-env-example

📚Convert mutli line environment variable to file with Travis-ci in project settings
https://github.com/gableroux/travis-multiline-env-example

environment-variables example file travis-ci

Last synced: 26 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# Travis-CI multiline env variables example

[![Build Status](https://travis-ci.com/GabLeRoux/travis-multiline-env-example.svg?branch=master)](https://travis-ci.com/GabLeRoux/travis-multiline-env-example)

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. :v:

## The solution

As described in [travis-ci#7715](https://github.com/travis-ci/travis-ci/issues/7715#issuecomment-362536708), we can replace end lines by `\n` and wrap the environment variable in settings with `"$(echo -e '` and `')"`.

### Example:

Expected content

```xml



```

The above content with endlines replaced:

```xml
\n \n \n \n
```

What we actually need to add in Travis environment variables settings:

```xml
"$(echo -e '\n \n \n \n')"
```

:white_check_mark: [Confirmed working here](https://travis-ci.com/GabLeRoux/travis-multiline-env-example)