This commit is contained in:
		
							parent
							
								
									93234fbbe2
								
							
						
					
					
						commit
						e26bf17c17
					
				| @ -24,25 +24,39 @@ jobs: | |||||||
|       - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." |       - 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." |       - run: echo "🖥️ The workflow is now ready to test your code on the runner." | ||||||
| 
 | 
 | ||||||
|       # 前端项目构建步骤 |       # 设置超时的Node.js安装 | ||||||
|       - name: Setup Node.js |       - name: Setup Node.js | ||||||
|         uses: actions/setup-node@v3 |         uses: actions/setup-node@v3 | ||||||
|  |         timeout-minutes: 5 | ||||||
|         with: |         with: | ||||||
|           node-version: '23.5.0' # 根据项目需求调整Node版本 |           node-version: '23.5.0' | ||||||
| 
 | 
 | ||||||
|       - name: Install dependencies |       - 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 |       - 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 |       - 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 |           zip -r frontend-dist.zip dist | ||||||
|           mv frontend-dist.zip /yantoo/frontend/ |           mv frontend-dist.zip /yantoo/frontend/ | ||||||
| 
 | 
 | ||||||
|       - name: Extract package in target directory |       - name: Extract package in target directory | ||||||
|         run: |           |         run: | | ||||||
|           cd /yantoo/frontend/ |           cd /yantoo/frontend/ | ||||||
|           unzip -o frontend-dist.zip |           unzip -o frontend-dist.zip | ||||||
|           rm frontend-dist.zip |           rm frontend-dist.zip | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 libingxiang
						libingxiang