Next.js 自动化部署到VPS的本地Shell 脚本

2 min read

自动化commit和执行脚本

// dev.sh

git add .
# 提交当前的时间戳
git commit -m "dev:$(date +%Y%m%d-%H%M%S)"
git push
# 需要先提交代码到远程仓库中
ssh 47 -T <  "./upload.sh"


ssh 远程执行本地脚本

cd next-site
yarn
git fetch --all
git reset --hard origin/master
git pull
npm i
npm run build
pm2 restart 0
pm2 save