Reputation: 97
I am trying to set up my travis.yml file so that by default if the branch is not master the files get uploaded to /var/www/test but if the branch is master they get uploaded to /var/www/html. I've seen that using conditionals in the .yml file is possible, reference this post in the Travis Docs. I have made the following .travis.yml file but when I validate it using Travis WebLint it comes up with this error: syntax error: (): mapping values are not allowed in this context at line 9 column 8
Any ideas?
language: generic
env:
global:
- "FTP_USER=user"
- "FTP_PASSWORD=password"
- "FTP_DIR=/var/www/test"
if: branch = master
env: FTP_DIR=/var/www/html/
after_success:
"curl --ftp-create-dirs -T uploadfilename -u $FTP_USER:$FTP_PASSWORD ftp://<hidden>$FTP_DIR"
Upvotes: 1
Views: 51
Reputation: 94483
Maintain different .travis.yml in different branches. In master:
env:
global:
- "FTP_USER=user"
- "FTP_PASSWORD=password"
- "FTP_DIR=/var/www/html"
And in test:
env:
global:
- "FTP_USER=user"
- "FTP_PASSWORD=password"
- "FTP_DIR=/var/www/test"
Be careful with merges.
Upvotes: 1