tag:help.appveyor.com,2012-11-13:/discussions/problems/15083-hello-i-have-a-pretty-simple-scenario-where-i-want-to-deploy-to-two-different-locations-depending-on-the-commit-happening-on-dev-branch-or-master-since-its-imposible-to-have-two-different-yml-files-on-these-branches-since-one-overwrites-the-other-every-tiAppVeyor: Discussion 2018-09-11T21:00:50Ztag:help.appveyor.com,2012-11-13:Comment/456760132018-07-12T11:04:24Z2018-07-12T11:06:11ZDeploying to two different locations based on branch commited and built yml parse error<div><p>Hello!</p>
<p>I have a pretty simple scenario where I want to deploy to two different locations depending on the commit happening on dev branch or master. Since its imposible to have two different yml files on these branches since one overwrites the other every time I came about this article here:</p>
<p><a href="https://www.appveyor.com/blog/2014/07/23/appveyor-yml-and-multiple-branches/">https://www.appveyor.com/blog/2014/07/23/appveyor-yml-and-multiple-...</a></p>
<p>The article makes it clear we can use one yml file to set htis up howver I het an error:<br>
Error parsing appveyor.yml: (Line: 35, Col: 1, Idx: 554) - (Line: 35, Col: 9, Idx: 562): Duplicate key</p>
<p>Here is my yml</p>
<p>image: Visual Studio 2017</p>
<p>environment:<br>
nodejs_version: "6"</p>
<p>platform:<br>
- x64</p>
<p>install:<br>
- ps: Install-Product node $env:nodejs_version - yarn install --no-progress</p>
<p>build_script:<br>
- yarn ng -- build --prod --aot --no-progress</p>
<p>cache:<br>
- node_modules -> yarn.lock - "%LOCALAPPDATA%/Yarn"</p>
<p>branches:<br>
only: - master</p>
<p>artifacts:<br>
path: '\dist\' name: NINJASPA</p>
<p>before_deploy:<br>
ssh root@ipadresshere -t "ls; rm -r -v /var/www/asp/ninjacodingfront/*; ls; exit; bash --login"</p>
<p>deploy:<br>
provider: Environment name: NinjaCodingFront</p>
<p>branches:<br>
only: - dev</p>
<p>artifacts:<br>
path: '\dist\' name: NINJASPADEV</p>
<p>before_deploy:<br>
ssh root@ipadresshere -t "ls; rm -r -v /var/www/asp/ninjacodingfrontdev/*; ls; exit; bash --login"</p>
<p>deploy:<br>
provider: Environment name: NinjaCodingFrontDev</p>
<p>Line 35 is where branches dev comes come:</p>
<p>branches: --------------- (line 35)<br>
only: - dev</p>
<p>No idea what to do next, please help. Hope its solvable. Thanks!</p></div>yzolotarevtag:help.appveyor.com,2012-11-13:Comment/456760132018-07-12T11:49:29Z2018-07-12T11:49:29ZDeploying to two different locations based on branch commited and built yml parse error<div><p>I tried adding for: before the first branches block. It doesn't work either, produces same error.</p></div>yzolotarevtag:help.appveyor.com,2012-11-13:Comment/456760132018-07-12T14:28:31Z2018-07-12T14:28:31ZDeploying to two different locations based on branch commited and built yml parse error<div><p>Got it solved.</p>
<p>image: Visual Studio 2017</p>
<p>platform:<br>
- x64</p>
<p>environment:<br>
nodejs_version: "6"</p>
<p>install:<br>
- ps: Install-Product node $env:nodejs_version - yarn install --no-progress</p>
<p>build_script:<br>
- yarn ng -- build --prod --aot --no-progress</p>
<p>cache:<br>
- node_modules -> yarn.lock - "%LOCALAPPDATA%/Yarn"</p>
<p>for:</p>
<p>- branches: only: - master</p>
<p>deploy: provider: Environment name: NinjaCodingFront</p>
<p>artifacts: path: '\dist\' name: NINJASPA</p>
<p>before_deploy:<br>
ssh root@xxxxxxxxx -t "ls; rm -r -v /var/www/asp/ninjacodingfront/*; ls; exit; bash --login"</p>
<p>- branches: only: - dev</p>
<p>deploy: provider: Environment name: NinjaCodingFrontDev</p>
<p>artifacts: path: '\dist\' name: NINJASPADEV</p>
<p>before_deploy:<br>
ssh root@xxxxxxxxxxx -t "ls; rm -r -v /var/www/asp/ninjacodingfrontdev/*; ls; exit; bash --login"</p></div>yzolotarevtag:help.appveyor.com,2012-11-13:Comment/456760132018-07-12T14:29:42Z2018-07-12T14:29:42ZDeploying to two different locations based on branch commited and built yml parse error<div><p>It seems u have to watch out for line indents in appveyor.yml it really affects how the code is read.</p></div>yzolotarevtag:help.appveyor.com,2012-11-13:Comment/456760132018-07-12T16:13:29Z2018-07-12T16:13:29ZDeploying to two different locations based on branch commited and built yml parse error<div><p>Glad you got it sorted.<br>
Yes, Yaml itself requires <a href="http://yaml.org/spec/1.2/2009-07-21/spec.html#id2576668">functional indentation</a></p></div>Owen McDonnell