Deploying to two different locations based on branch commited and built yml parse error
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 time I came about this article here:
https://www.appveyor.com/blog/2014/07/23/appveyor-yml-and-multiple-branches/
The article makes it clear we can use one yml file to set htis up howver I het an error:
Error parsing appveyor.yml: (Line: 35, Col: 1, Idx: 554) - (Line: 35, Col: 9, Idx: 562): Duplicate key
Here is my yml
image: Visual Studio 2017
environment:
nodejs_version: "6"
platform:
- x64
install:
- ps: Install-Product node $env:nodejs_version
- yarn install --no-progress
build_script:
- yarn ng -- build --prod --aot --no-progress
cache:
- node_modules -> yarn.lock
- "%LOCALAPPDATA%/Yarn"
branches:
only:
- master
artifacts:
path: '\dist\'
name: NINJASPA
before_deploy:
ssh root@ipadresshere -t "ls; rm -r -v /var/www/asp/ninjacodingfront/*; ls; exit; bash --login"
deploy:
provider: Environment
name: NinjaCodingFront
branches:
only:
- dev
artifacts:
path: '\dist\'
name: NINJASPADEV
before_deploy:
ssh root@ipadresshere -t "ls; rm -r -v /var/www/asp/ninjacodingfrontdev/*; ls; exit; bash --login"
deploy:
provider: Environment
name: NinjaCodingFrontDev
Line 35 is where branches dev comes come:
branches: --------------- (line 35)
only:
- dev
No idea what to do next, please help. Hope its solvable. Thanks!
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by yzolotarev on 12 Jul, 2018 11:49 AM
I tried adding for: before the first branches block. It doesn't work either, produces same error.
2 Posted by yzolotarev on 12 Jul, 2018 02:28 PM
Got it solved.
image: Visual Studio 2017
platform:
- x64
environment:
nodejs_version: "6"
install:
- ps: Install-Product node $env:nodejs_version
- yarn install --no-progress
build_script:
- yarn ng -- build --prod --aot --no-progress
cache:
- node_modules -> yarn.lock
- "%LOCALAPPDATA%/Yarn"
for:
-
branches:
only:
- master
deploy:
provider: Environment
name: NinjaCodingFront
artifacts:
path: '\dist\'
name: NINJASPA
before_deploy:
ssh root@xxxxxxxxx -t "ls; rm -r -v /var/www/asp/ninjacodingfront/*; ls; exit; bash --login"
-
branches:
only:
- dev
deploy:
provider: Environment
name: NinjaCodingFrontDev
artifacts:
path: '\dist\'
name: NINJASPADEV
before_deploy:
ssh root@xxxxxxxxxxx -t "ls; rm -r -v /var/www/asp/ninjacodingfrontdev/*; ls; exit; bash --login"
3 Posted by yzolotarev on 12 Jul, 2018 02:29 PM
It seems u have to watch out for line indents in appveyor.yml it really affects how the code is read.
Support Staff 4 Posted by Owen McDonnell on 12 Jul, 2018 04:13 PM
Glad you got it sorted.
Yes, Yaml itself requires functional indentation
Ilya Finkelshteyn closed this discussion on 11 Sep, 2018 09:00 PM.