我这边Electron是须要多平台发布的,因此须要多端的持续集成,我这边演示Mac和Windows下这俩平台。vue
持续集成vue项目请参考上一篇文章 http://www.javashuo.com/article/p-bcjuzymi-cn.htmlnode
编译的包很大,会出现too large 的错误,由于默认是100Mb,build文件里面东西不少,也很大,因此设置的大一点git
须要管理员登陆并设置maximumnpm
脚本和上一篇的差很少,只是多了build目录json
# 构建阶段 stages: - install_deps # - test - build # - deploy_test # - deploy_production # 缓存(默认状况下,每一个pipelines和jobs中能够共享一切,从GitLab 9.0开始) cache: # key: ${CI_BUILD_REF_NAME} # windows下??? # key: "%CI_COMMIT_REF_SLUG%" # key: ${CI_BUILD_STAGE} # 缓存每一个分支 # key: "$CI_COMMIT_REF_NAME" paths: # 缓存node_mudules将大大提升ci运行的速度 - node_modules/ - dist/ - build/ # 构建工做-安装依赖 job_install_deps: stage: install_deps # 匹配使用哪一个tag的runner(注册时填写的) tags: - specific_electron_win only: - develop - master script: - npm install # 构建工做-运行测试用例 #job_test: # stage: test # only: # - develop # - master # script: # - npm run test # 构建工做-编译 job_build: stage: build # 匹配使用哪一个tag的runner tags: - specific_electron_win # 全部操做只在以下分支上进行 only: - dev - master # 阶段运行的脚本 script: # 你本身的package.json中scripts中的脚本 - npm run build # 工件,能够缓存在gitlab的流水线记录中,供直接下载 artifacts: # 使用当前stage和分支名称做为存档名称 # name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" name: "%CI_JOB_STAGE%_%CI_COMMIT_REF_NAME%" # 工件缓存的有效时间 expire_in: 3 days # 路径 paths: # 工件指向的目录,这里指整个dist目录 - dist - build # 构建工做-部署测试服务器 #job_deploy_test: # stage: deploy_test # only: # - develop # script: # - pm2 delete app || true # - pm2 start app.js --name app # 构建工做-部署生产服务器 #job_deploy_production: # stage: deploy_production # only: # - master # script: # - bash scripts/deploy/deploy.sh
...windows