From b88b4d515644ac6eaf1c85d8e5acd0da98d85b78 Mon Sep 17 00:00:00 2001 From: golc <2483469113@qq.com> Date: Tue, 24 Feb 2026 13:50:35 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BF=81=E7=A7=BB=E5=88=B0=20Vercel=20?= =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 Gitea Actions 配置 - 添加 Vercel 配置文件 - 配置 Serverless 函数路由 Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/deploy.yml | 82 ------------------------------------- vercel.json | 15 +++++++ 2 files changed, 15 insertions(+), 82 deletions(-) delete mode 100644 .gitea/workflows/deploy.yml create mode 100644 vercel.json diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml deleted file mode 100644 index 957cc52..0000000 --- a/.gitea/workflows/deploy.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Backend CI/CD - -on: - push: - branches: - - main - - master - pull_request: - branches: - - main - - master - -jobs: - # 构建和测试 - build: - runs-on: ubuntu-latest - steps: - - name: 检出代码 - uses: actions/checkout@v3 - - - name: 设置 Node.js - uses: actions/setup-node@v3 - with: - node-version: '18' - - - name: 安装 pnpm - run: npm install -g pnpm - - - name: 安装依赖 - run: pnpm install --frozen-lockfile - - - name: 代码检查 - run: | - echo "运行代码检查..." - # pnpm run lint - - - name: 运行测试 - run: | - echo "运行单元测试..." - # pnpm run test - - - name: 构建项目 - run: pnpm run build - - - name: 上传构建产物 - uses: actions/upload-artifact@v3 - with: - name: dist - path: dist/ - retention-days: 1 - - # 部署到生产环境 - deploy: - needs: build - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' - steps: - - name: 拉取最新代码 - run: | - cd /root/self_proj/oauth_nest_demo - git pull origin main || git pull origin master - - - name: 重新构建并启动后端容器 - run: | - cd /root/self_proj - docker compose up -d --build backend - - - name: 健康检查 - run: | - echo "等待服务启动..." - sleep 15 - curl -f http://localhost:3000/api || exit 1 - - - name: 通知部署结果 - if: always() - run: | - if [ ${{ job.status }} == 'success' ]; then - echo "✅ 后端部署成功!" - echo "访问地址: https://tdapi.lcdd.net" - else - echo "❌ 后端部署失败!" - fi diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..c4136c8 --- /dev/null +++ b/vercel.json @@ -0,0 +1,15 @@ +{ + "version": 2, + "builds": [ + { + "src": "src/main.ts", + "use": "@vercel/node" + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "src/main.ts" + } + ] +}