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: 3 months ago
JSON representation
📚Convert mutli line environment variable to file with Travis-ci in project settings
- Host: GitHub
- URL: https://github.com/gableroux/travis-multiline-env-example
- Owner: GabLeRoux
- Created: 2018-05-13T04:35:15.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-14T18:15:37.000Z (over 7 years ago)
- Last Synced: 2025-03-31T08:13:00.891Z (about 1 year ago)
- Topics: environment-variables, example, file, travis-ci
- Homepage: https://github.com/travis-ci/travis-ci/issues/7715#issuecomment-362536708
- Size: 3.91 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# Travis-CI multiline env variables example
[](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)