前端简易部署脚本,远程拉取 git 仓库
由于自己部署前端代码到服务器的时候,每次都需要自己登陆到服务器,拉取 git 仓库特别麻烦。所以就产生这个简化自己的操作
自己使用的是nginx,这里假设你会了 nginx。
如下是常见的 nginx 的前端配置
server {
listen 80;
server_name active.xxx.cn;
root /home/wwwroot/xx.com/dist;
index index.html
}
"scripts": {
"test": "npm run test",
"deploy": "ssh [username]@[ip] 'cd /home/wwwroot/xx.com/ && sh deploy.sh'",
"deploy:master": "ssh [username]@[ip] 'cd /home/wwwroot/xx.com/ && sh deploy.sh master'"
},
使用软链实现无缝切换新旧版本,
在不影响开发仓库的情况回滚代码