安装
需要安装的程序:
1.下载jenkins windows版本 2.400 此版本需要jdk11
https://www.jenkins.io/
按着提示安装即可
2.下载jdk 11
https://login.oracle.com/
按着提示安装即可
部署pc
1.新建项目
2.源码管理
3.添加git用户
4.Build Steps 构建
初始化npm – npm install --registry=https://registry.npmmirror.com
5.打包 – yarn build:no-cache
6.备份当前程序包 – xcopy E:\data\bzb\pc\dist E:\data\bzb\pc\dist-bak /e
7.删除现场的包 – del /s /Q E:\data\bzb\pc\dist
8.将打包好的文件复制到目标文件 – xcopy C:\ProgramData\Jenkins.jenkins\workspace\standardpc8080\dist E:\data\bzb\pc\dist /e
部署后端服务
1.配置jenkins不关闭衍生的程序
2.git配置
3.打包 –
mvn clean package -Dmaven.test.skip=true --settings E:\opt\software\maven\apache-maven-3.5.4\conf\settings.xml
4.备份程序 –
copy E:\data\bzb\server\yunxiao-server.jar E:\data\bzb\server\yunxiao-server-bak.jar /y
5.复制打好的包到目标目录 –
copy C:\ProgramData\Jenkins\.jenkins\workspace\standardserver8080\config\target\yunxiao-server.jar E:\data\bzb\server\yunxiao-server.jar /y
6.关闭程序黑框 –
set port=8848
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%port%"') do (
echo %%i %%j %%k %%l %%m
if "%%k" == "0.0.0.0:0" (
if "%%m" == "" (
taskkill /pid %%l /f
) else if "%%m" == "0" (
echo 0
)else if "%%m" gtr "0" (
taskkill /pid %%m /f
)
)
)
7.到程序目录启动程序 –
cd E:\data\bzb\server
E:
start javaw -Xms4g -Xmx4g -Djava.io.tmpdir=E:\data\bzb\tmp -jar E:\data\bzb1\server\yunxiao-server.jar --spring.config.location=E:\data\bzb\server\application.yml
exit