根据分支提交yml解析错误,将Appveyor部署到2个不同的位置

时间:2018-07-12 11:13:04

标签: continuous-integration continuous-deployment appveyor

我有一个非常简单的场景,我想根据在dev分支或master上发生的提交,将其部署到两个不同的位置。由于每次我在此浏览本文时,一个分支都会覆盖另一个分支,因此不可能在这些分支上拥有两个不同的yml文件:

https://www.appveyor.com/blog/2014/07/23/appveyor-yml-and-multiple-branches/

本文清楚地表明,无论我遇到什么错误,我们都可以使用一个yml文件设置htis: 解析appveyor.yml时出错:(行:35,列:1,IDX:554)-(行:35,列:9,IDX:562):重复密钥

这是我的yml

buildapp.sh -build1 → script1.sh
buildapp.sh -build2 → script2.sh

不知道下一步该怎么做,请帮忙。希望它能解决。谢谢!

1 个答案:

答案 0 :(得分:1)

所以最后这是怎么做的:

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"