gitlab ci自动化构建与部署常用配置 - npm 管理的下前端项目
gitlab ci自动化构建与部署常用配置 - npm 管理的下前端项目
这篇讲的是webpack 管理的项目,基本上也没太大区别。在使用 Gitlab CI 进行自动化构建部署的时候,需要新建一个 .gitlab-ci.yml配置文件,里面是我们自动化构建的具体步骤的脚本:
image: node:8 stages: - build - deploy - prod build: stage: build script: - pwd # 可以设置 npm镜像 - npm config set registry https://registry.npm.taobao.org - npm install - npm run build tags: - docker artifacts: expire_in: 1 days # 保留一天 paths: - dist/** allow_failure: false deploy: stage: deploy needs: - job: build artifacts: true only: - master tags: - Grid script: - pwd prod: stage: prod needs: - job: build artifacts: true only: - release tags: - docker script: - # 如果不是在本地的服务器,远程的可以使用一些scp 命令或者ssh 远程执行命令,或者服务器上配置脚本,自动检测程序等自动化部署