2026-04-23 16:37:14 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
|
|
git restore .
|
|
|
|
|
git fetch origin
|
|
|
|
|
git rebase origin/master
|
|
|
|
|
openresty_html_dir='/usr/local/openresty/nginx/html/music-room'
|
|
|
|
|
|
|
|
|
|
mkdir -p $openresty_html_dir
|
|
|
|
|
|
2026-04-26 21:39:15 +08:00
|
|
|
# 使用 hostname(非 $HOSTNAME):非登录 SSH 下 HOSTNAME 常为空,会导致误跑成 npm run build:
|
|
|
|
|
CUR_HOST=$(hostname | cut -d. -f1)
|
2026-04-23 16:37:14 +08:00
|
|
|
|
2026-04-26 21:39:15 +08:00
|
|
|
if [ "$CUR_HOST" != "moicen" ]; then
|
2026-04-23 16:37:14 +08:00
|
|
|
echo "HOST ${CUR_HOST} is not moicen!"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
rm -rf node_modules && pnpm install
|
2026-04-26 21:39:15 +08:00
|
|
|
npm run build:moicen
|
2026-04-23 16:37:14 +08:00
|
|
|
|
|
|
|
|
sudo cp -r ./dist/* $openresty_html_dir
|
|
|
|
|
|
|
|
|
|
SERVER=${1:-1}
|
|
|
|
|
|
|
|
|
|
# upload to upyun
|
|
|
|
|
cd cdn
|
|
|
|
|
sh upload_assets.sh .${CUR_HOST}_upyun_pass $SERVER
|