peng
2026-03-25 67d3b57765b0ba66ae25a9da84a16e44a4ef2937
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# 遇到问题则中断
set -e
 
echo "准备发布到测试服务器:25.30.15.85:/root/cube/dist"
VERSION=`npx select-version-cli`
 
read -p "确定发布版本为 $VERSION ? (y/n)" -n 1 -r
echo    # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
  # build
  echo "正在打包 $VERSION ..."
  yarn build
 
  # 修改package.json中的版本号
  npm  --no-git-tag-version version $VERSION
 
  echo "正在上传到测试服务器..."
  # 通过scp上传到测试服
  server_pwd=chengxun
  expect -c "
  spawn scp -r dist root@25.30.15.85:/root/cube
  
  expect \"password:\"
  send \"${server_pwd}\r\"
  expect eof
  "
fi