nailuoGG
8/23/2016 - 1:54 AM

gitlab-ci系统配置文件

gitlab-ci系统配置文件

#image: node
image: daocloud.io/nailuogg/fis3

#定义流程
stages:
  - install_deps
  - test
  - build
  - deploy_dev
  - deploy_test
# deploy_pro

# 密钥
before_script:
  - mkdir -p ~/.ssh
  - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
  - chmod 600  ~/.ssh/id_rsa
  - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config

#缓存一些常用的值和目录
cache:
  key: ${CI_BUILD_REF_NAME}
  paths:
    - node_modules/
    - output/

#安装依赖
install_deps:
  stage: install_deps
  only:
    - develop
    - master
  script:
    - npm --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/mirrors/node install

# 编译
build:
  stage: build
  only:
    - develop
    - master
  script:
    - npm run clean
    - npm run build

# 部署测试服务器A
deploy_test:
  stage: deploy_test
  only:
    - develop
  script:
    - rsync -avz ./output/   -e ssh  root@127.0.0.1:/root/project/finnancial-h5/output

#部署开发服务器
#deploy_test:
#  stage: deploy_dev
#  only:
#    - develop
#  script:
#    - rsync -avz ./output/   -e ssh  root@172.16.1.12:/root/projects/h5/output


#部署生产服务器
#deploy_test:
#  stage: deploy_pro
#  only:
#    - develop
#  script:
#    - rsync -avz ./output/   -e ssh  root@172.16.1.12:/root/projects/h5/output
#