From e26bf17c17e747f970be5cf55128e5ed5de8f50a Mon Sep 17 00:00:00 2001 From: libingxiang Date: Mon, 4 Aug 2025 16:21:34 +0800 Subject: [PATCH] ci --- .gitea/workflows/deploy.yaml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 7a06d43..d9d36b9 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -24,25 +24,39 @@ jobs: - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - # 前端项目构建步骤 + # 设置超时的Node.js安装 - name: Setup Node.js uses: actions/setup-node@v3 + timeout-minutes: 5 with: - node-version: '23.5.0' # 根据项目需求调整Node版本 + node-version: '23.5.0' - name: Install dependencies - run: npm install # 或者 yarn install + run: | + timeout 300 npm install || { + echo "npm install failed or timed out" + exit 1 + } - name: Build project - run: npm run build # 或者 yarn build,根据package.json中的脚本调整 + run: | + timeout 300 npm run build || { + echo "Build failed or timed out" + exit 1 + } - name: Package dist folder - run: | + run: | + if [ ! -d "dist" ]; then + echo "Error: dist directory not found" + ls -la + exit 1 + fi zip -r frontend-dist.zip dist mv frontend-dist.zip /yantoo/frontend/ - name: Extract package in target directory - run: | + run: | cd /yantoo/frontend/ unzip -o frontend-dist.zip rm frontend-dist.zip