jenkins 自动构建vue项目步骤

/ 默认分类 / 0 条评论 / 140浏览

安装nodejs插件

Manage Jenkins>Manage Plugins >可选插件搜索>nodejs

全局环境配置

Manage Jenkins>Global Tool Configuration> 配置如下项
JDK,Maven,NodeJS

新建一个任务

输入任名称后 >选择Freestyle project> 点击确定

配置任务信息,配置项

源码管理git 添加url 用户名 密码,选择版本分支*/master

构建触发器

选择 Build when a change is pushed to Gogs

构建环境

选择 Provide Node & npm bin/ folder to PATH
三项设置 
NodeJS Installation
npmrc file
Cache location

构建

cd ${WORKSPACE}
npm install --registry=https://registry.npm.taobao.org
npm run build
cd dist && cp -r * /www/server/pigxui/

构建后操作

选择 delete workspace when build is done