Touko
4 months ago|views:145
Jenkins Vue项目自动部署
1.安装Jenkins
安装推荐的插件
2.安装自动部署所需的插件
NodeJS Plugin -> 构建打包Vue项目
Publish Over SSH -> 将我们构建打包的Vue项目上传至服务器
前往Plugins即可搜索安装

配置SSH服务

若服务器未启用 SSH 服务
-
打开“设置” → “应用” → “可选功能”
-
点击 “添加功能”
-
搜索并安装 OpenSSH Server
或PowerShell 管理员模式下运行:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0、
启动 SSH 服务:
Start-Service sshdSet-Service -Name sshd -StartupType 'Automatic'
确保 Windows 防火墙已开放端口 22:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
3.新建项目
4.配置项目

源码管理:私用仓库需填写Credentials

触发器: 勾选第四个检测当 GitHub 有新的提交(push)时,通过 webhook 主动通知 Jenkins,让它立即去拉取代码并触发构建。

GitHub webhook 配置:

选择环境

构建步骤

构建完成后的操作

tags:
0
1
comments:
It's deserted here, it looks like no one's been here
