Fix: 修正脚本

This commit is contained in:
2025-10-09 00:26:17 +08:00
parent 345eaece36
commit e8f5a50b3e
2 changed files with 16 additions and 5 deletions
+15 -5
View File
@@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
# 自动部署脚本 # 自动部署脚本
# 每天定时从 Gitea 拉取最新代码并执行构建
# 设置部署目录 # 设置部署目录
DEPLOY_DIR="/root/online-slide" DEPLOY_DIR="/root/online-slide"
@@ -12,10 +11,21 @@ cd "$DEPLOY_DIR" || exit 1
# 拉取最新代码(仓库是公开的,无需认证) # 拉取最新代码(仓库是公开的,无需认证)
git pull origin main git pull origin main
# 安装依赖(如果需要)
npm install
# 执行构建 npm config set registry https://registry.npmmirror.com
npm run build
export PUPPETEER_SKIP_DOWNLOAD=1
# 安装依赖
npm install --verbose
# 启动服务
# 安装PM2(如果尚未安装)
npm install -g pm2
# 使用PM2启动服务,确保只有一个实例运行
pm2 start npm --name "online-slide" -- run web
# 保存PM2进程列表
pm2 save
echo "部署完成" echo "部署完成"
+1
View File
@@ -10,6 +10,7 @@
"scripts": { "scripts": {
"test": "gulp test", "test": "gulp test",
"start": "gulp serve", "start": "gulp serve",
"web": "gulp serve --host 0.0.0.0 --port 3000",
"build": "gulp build" "build": "gulp build"
}, },
"repository": { "repository": {