1、设置 Node 环境

使用 jenkins 发布 前端 项目

2、创建一个自由风格的项目

使用 jenkins 发布 前端 项目

3、添加项目描述

使用 jenkins 发布 前端 项目

4、添加 git 地址

使用 jenkins 发布 前端 项目

5、设置构建环境

使用 jenkins 发布 前端 项目

6、通过 shell 打包代码

使用 jenkins 发布 前端 项目

7、发布到服务器上

使用 jenkins 发布 前端 项目

脚本如下:

# 获取环境变量
source /etc/profile

productName="woc-console"
productPath="console/subApp/${productName}"

# 备份之前的文件
mkdir -p /opt/bak/web
mv /usr/share/nginx/html/${productPath} /opt/bak/web/${productName}_$(date +%F-%H-%M)

# 部署新文件
mkdir -p /usr/share/nginx/html/${productPath}
mv /opt/web/${productName}/build.tar.gz /usr/share/nginx/html/${productPath}
cd /usr/share/nginx/html/${productPath}
tar xvf build.tar.gz
rm -f build.tar.gz

参考:
https://blog.csdn.net/liub37/article/details/83272398
https://blog.csdn.net/jonsonler/article/details/81317352
https://cloud.tencent.com/developer/article/1342915

相关文章:

  • 2022-12-23
  • 2021-08-06
  • 2022-01-11
  • 2022-01-26
  • 2022-01-21
  • 2022-12-23
  • 2021-12-15
猜你喜欢
  • 2021-12-02
  • 2021-09-04
  • 2021-05-22
  • 2022-12-23
  • 2021-07-23
  • 2021-09-27
相关资源
相似解决方案